Class: CodeTools::AST::Lambda

Inherits:
Node
  • Object
show all
Defined in:
lib/rubinius/code/ast/definitions.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph, #attributes, #children, #defined, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk

Constructor Details

#initialize(line, arguments, body) ⇒ Lambda

Returns a new instance of Lambda.



310
311
312
313
314
# File 'lib/rubinius/code/ast/definitions.rb', line 310

def initialize(line, arguments, body)
  @line = line
  @arguments = arguments
  @body = Iter.new line, arguments, body
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



308
309
310
# File 'lib/rubinius/code/ast/definitions.rb', line 308

def arguments
  @arguments
end

#bodyObject

Returns the value of attribute body.



308
309
310
# File 'lib/rubinius/code/ast/definitions.rb', line 308

def body
  @body
end

Instance Method Details

#bytecode(g) ⇒ Object



316
317
318
319
320
321
322
# File 'lib/rubinius/code/ast/definitions.rb', line 316

def bytecode(g)
  pos(g)

  g.push_rubinius
  @body.bytecode(g)
  g.send_with_block :lambda, 0, false
end

#to_sexpObject



324
325
326
# File 'lib/rubinius/code/ast/definitions.rb', line 324

def to_sexp
  [:lambda, @arguments.to_sexp, [:scope, @body.body.to_sexp]]
end