Class: Twostroke::AST::Call

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Call

Returns a new instance of Call.



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

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

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



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

def arguments
  @arguments
end

#calleeObject

Returns the value of attribute callee.



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

def callee
  @callee
end

Instance Method Details

#collapseObject



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

def collapse
  self.class.new callee: callee.collapse, arguments: arguments.map(&:collapse)
end

#walk(&bk) ⇒ Object



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

def walk(&bk)
  if yield self
    callee.walk &bk
    arguments.each { |arg| arg.walk &bk }
  end
end