Class: Riml::ScopeNode

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argument_variable_namesObject



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

def argument_variable_names
  @argument_variable_names ||= Set.new
end

#for_node_variable_namesObject



715
716
717
# File 'lib/nodes.rb', line 715

def for_node_variable_names
  @for_node_variable_names ||= Set.new
end

#functionObject Also known as: function?

Returns the value of attribute function.



713
714
715
# File 'lib/nodes.rb', line 713

def function
  @function
end

Instance Method Details

#initialize_copy(source) ⇒ Object



725
726
727
728
729
730
# File 'lib/nodes.rb', line 725

def initialize_copy(source)
  super
  self.for_node_variable_names = for_node_variable_names.dup
  self.argument_variable_names = argument_variable_names.dup
  self.function = source.function
end

#merge(other) ⇒ Object



732
733
734
# File 'lib/nodes.rb', line 732

def merge(other)
  dup.merge! other
end

#merge!(other) ⇒ Object



736
737
738
739
740
741
742
743
744
# File 'lib/nodes.rb', line 736

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