Class: StarlarkCompiler::AST::FunctionDeclaration

Inherits:
Node
  • Object
show all
Defined in:
lib/starlark_compiler/ast.rb

Constant Summary

Constants inherited from Node

Node::TYPE

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, args, body, **kwargs) ⇒ FunctionDeclaration

Returns a new instance of FunctionDeclaration.



148
149
150
151
152
153
# File 'lib/starlark_compiler/ast.rb', line 148

def initialize(name, args, body, **kwargs)
  @name = name
  @args = args.map(&method(:node))
  @body = body.map(&method(:node))
  @kwargs = kwargs.transform_values(&method(:node))
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



147
148
149
# File 'lib/starlark_compiler/ast.rb', line 147

def args
  @args
end

#bodyObject (readonly)

Returns the value of attribute body.



147
148
149
# File 'lib/starlark_compiler/ast.rb', line 147

def body
  @body
end

#kwargsObject (readonly)

Returns the value of attribute kwargs.



147
148
149
# File 'lib/starlark_compiler/ast.rb', line 147

def kwargs
  @kwargs
end

#nameObject (readonly)

Returns the value of attribute name.



147
148
149
# File 'lib/starlark_compiler/ast.rb', line 147

def name
  @name
end