Class: Riml::ScopeNode

Inherits:
Object
  • Object
show all
Defined in:
lib/riml/nodes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argument_variable_namesObject



724
725
726
# File 'lib/riml/nodes.rb', line 724

def argument_variable_names
  @argument_variable_names ||= Set.new
end

#for_node_variable_namesObject



720
721
722
# File 'lib/riml/nodes.rb', line 720

def for_node_variable_names
  @for_node_variable_names ||= Set.new
end

#functionObject Also known as: function?

Returns the value of attribute function.



718
719
720
# File 'lib/riml/nodes.rb', line 718

def function
  @function
end

Instance Method Details

#merge(other) ⇒ Object



730
731
732
# File 'lib/riml/nodes.rb', line 730

def merge(other)
  dup.merge! other
end

#merge!(other) ⇒ Object



738
739
740
741
742
743
744
745
746
# File 'lib/riml/nodes.rb', line 738

def merge!(other)
  unless other.is_a?(ScopeNode)
    raise ArgumentError, "other must be ScopeNode, is #{other.class}"
  end
  self.for_node_variable_names += other.for_node_variable_names
  self.argument_variable_names -= for_node_variable_names
  self.function = other.function
  self
end

#merge_parent_function(other) ⇒ Object



734
735
736
# File 'lib/riml/nodes.rb', line 734

def merge_parent_function(other)
  dup.merge_parent_function!(other)
end

#merge_parent_function!(other) ⇒ Object



748
749
750
751
752
753
754
755
# File 'lib/riml/nodes.rb', line 748

def merge_parent_function!(other)
  unless other.is_a?(ScopeNode)
    raise ArgumentError, "other must be ScopeNode, is #{other.class}"
  end
  self.for_node_variable_names += other.for_node_variable_names
  self.function = other.function
  self
end