Class: Twostroke::AST::Label

Inherits:
Base
  • Object
show all
Defined in:
lib/twostroke/ast/label.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#line

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Label

Returns a new instance of Label.



5
6
7
8
# File 'lib/twostroke/ast/label.rb', line 5

def initialize(*args)
  @statements = []
  super *args
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/twostroke/ast/label.rb', line 3

def name
  @name
end

#statementObject

Returns the value of attribute statement.



3
4
5
# File 'lib/twostroke/ast/label.rb', line 3

def statement
  @statement
end

Instance Method Details

#collapseObject



10
11
12
# File 'lib/twostroke/ast/label.rb', line 10

def collapse
  self.class.new name: name, statement: statement
end

#walk(&bk) ⇒ Object



14
15
16
17
18
# File 'lib/twostroke/ast/label.rb', line 14

def walk(&bk)
  if yield self
    statement.walk &bk
  end
end