Class: Loxxy::Ast::LoxFunStmt
- Defined in:
- lib/loxxy/ast/lox_fun_stmt.rb
Overview
A parse tree node that represents a Lox function declaration.
Instance Attribute Summary collapse
-
#body ⇒ Ast::LoxBlockStmt
readonly
The parse tree representing the function's body.
-
#is_method ⇒ Boolean
True if the function is a method.
-
#name ⇒ String
readonly
The function name.
-
#params ⇒ Array<String>
readonly
The parameter names.
Attributes inherited from LoxNode
Instance Method Summary collapse
-
#initialize(aPosition, aName, paramList, aBody) ⇒ LoxFunStmt
constructor
Constructor for a parse node that represents a Lox function declaration.
Methods inherited from LoxNode
Methods included from ASTVisitee
Constructor Details
#initialize(aPosition, aName, paramList, aBody) ⇒ LoxFunStmt
Constructor for a parse node that represents a Lox function declaration
26 27 28 29 30 31 32 |
# File 'lib/loxxy/ast/lox_fun_stmt.rb', line 26 def initialize(aPosition, aName, paramList, aBody) super(aPosition) @name = aName.dup @params = paramList @body = aBody @is_method = false end |
Instance Attribute Details
#body ⇒ Ast::LoxBlockStmt (readonly)
Returns the parse tree representing the function's body.
16 17 18 |
# File 'lib/loxxy/ast/lox_fun_stmt.rb', line 16 def body @body end |
#is_method ⇒ Boolean
Returns true if the function is a method.
19 20 21 |
# File 'lib/loxxy/ast/lox_fun_stmt.rb', line 19 def is_method @is_method end |
#name ⇒ String (readonly)
Returns the function name.
10 11 12 |
# File 'lib/loxxy/ast/lox_fun_stmt.rb', line 10 def name @name end |
#params ⇒ Array<String> (readonly)
Returns the parameter names.
13 14 15 |
# File 'lib/loxxy/ast/lox_fun_stmt.rb', line 13 def params @params end |