class DeepCover::Node::EmptyBody
Public Class Methods
new(base_node, parent:, index: 0, position: ChildCanBeEmpty.last_empty_position)
click to toggle source
Calls superclass method
DeepCover::Node::new
# File lib/deep_cover/node/empty_body.rb, line 5 def initialize(base_node, parent:, index: 0, position: ChildCanBeEmpty.last_empty_position) @position = position super(base_node, parent: parent, index: index, base_children: []) end
Public Instance Methods
is_statement()
click to toggle source
# File lib/deep_cover/node/empty_body.rb, line 15 def is_statement false end
loc_hash()
click to toggle source
# File lib/deep_cover/node/empty_body.rb, line 10 def loc_hash return {} if @position == true {expression: @position} end
rewriting_rules()
click to toggle source
When parent rewrites us, the %{node} must always be at the beginning because our location can also be rewritten by our parent, and we want the rewrite to be after it.
Calls superclass method
DeepCover::Node::Mixin::Rewriting#rewriting_rules
# File lib/deep_cover/node/empty_body.rb, line 21 def rewriting_rules rules = super rules.map do |expression, rule| [expression, "%{node};#{rule.sub('%{node}', 'nil;')}"] end end