Class: IV::Phonic::AST::FunctionLiteral

Inherits:
Literal show all
Defined in:
lib/iv/phonic/ast.rb

Instance Method Summary collapse

Methods inherited from Expression

as

Methods inherited from Node

#begin_position, #end_position, #program, #source

Constructor Details

#initialize(parent, expr) ⇒ FunctionLiteral

Returns a new instance of FunctionLiteral.



472
473
474
475
476
477
478
479
480
481
# File 'lib/iv/phonic/ast.rb', line 472

def initialize parent, expr
  super parent, expr
  if expr[:name]
    @name = Identifier.new self, expr[:name]
  else
    @name = nil
  end
  @params = expr[:params].map {|param| Identifier.new self, param }
  @body = expr[:body].map {|stmt| Statement.as self, stmt }
end