Class: Loxxy::Ast::LoxVarStmt
- Inherits:
-
LoxCompoundExpr
- Object
- LoxNode
- LoxCompoundExpr
- Loxxy::Ast::LoxVarStmt
- Defined in:
- lib/loxxy/ast/lox_var_stmt.rb
Overview
This AST node represents a variable declaration
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
Variable name.
Attributes inherited from LoxCompoundExpr
Attributes inherited from LoxNode
Instance Method Summary collapse
-
#initialize(aPosition, aName, aValue) ⇒ LoxVarStmt
constructor
A new instance of LoxVarStmt.
Methods inherited from LoxCompoundExpr
Methods inherited from LoxNode
Methods included from ASTVisitee
Constructor Details
#initialize(aPosition, aName, aValue) ⇒ LoxVarStmt
Returns a new instance of LoxVarStmt.
15 16 17 18 19 |
# File 'lib/loxxy/ast/lox_var_stmt.rb', line 15 def initialize(aPosition, aName, aValue) initial_value = aValue || Datatype::Nil.instance super(aPosition, [initial_value]) @name = aName end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns variable name.
10 11 12 |
# File 'lib/loxxy/ast/lox_var_stmt.rb', line 10 def name @name end |