Class: Loxxy::Ast::LoxClassStmt
- Inherits:
-
LoxCompoundExpr
- Object
- LoxNode
- LoxCompoundExpr
- Loxxy::Ast::LoxClassStmt
- Defined in:
- lib/loxxy/ast/lox_class_stmt.rb
Instance Attribute Summary collapse
-
#body ⇒ Array<Ast::LoxFunStmt>
readonly
The methods.
-
#name ⇒ String
readonly
The class name.
-
#superclass ⇒ Ast::LoxVariableExpr
readonly
Variable referencing the superclass (if any).
Attributes inherited from LoxCompoundExpr
Attributes inherited from LoxNode
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
Part of the 'visitee' role in Visitor design pattern.
-
#initialize(aPosition, aName, aSuperclassName, theMethods) ⇒ LoxClassStmt
constructor
A new instance of LoxClassStmt.
Methods inherited from LoxNode
Constructor Details
#initialize(aPosition, aName, aSuperclassName, theMethods) ⇒ LoxClassStmt
Returns a new instance of LoxClassStmt.
20 21 22 23 24 25 |
# File 'lib/loxxy/ast/lox_class_stmt.rb', line 20 def initialize(aPosition, aName, aSuperclassName, theMethods) super(aPosition, []) @name = aName.dup @superclass = aSuperclassName @body = theMethods end |
Instance Attribute Details
#body ⇒ Array<Ast::LoxFunStmt> (readonly)
Returns the methods.
15 16 17 |
# File 'lib/loxxy/ast/lox_class_stmt.rb', line 15 def body @body end |
#name ⇒ String (readonly)
Returns the class name.
9 10 11 |
# File 'lib/loxxy/ast/lox_class_stmt.rb', line 9 def name @name end |
#superclass ⇒ Ast::LoxVariableExpr (readonly)
Returns variable referencing the superclass (if any).
12 13 14 |
# File 'lib/loxxy/ast/lox_class_stmt.rb', line 12 def superclass @superclass end |
Instance Method Details
#accept(visitor) ⇒ Object
Part of the 'visitee' role in Visitor design pattern.
29 30 31 |
# File 'lib/loxxy/ast/lox_class_stmt.rb', line 29 def accept(visitor) visitor.visit_class_stmt(self) end |