Class: Loxxy::Ast::LoxVariableExpr

Inherits:
LoxNode
  • Object
show all
Defined in:
lib/loxxy/ast/lox_variable_expr.rb

Overview

This AST node represents a mention of a variable

Instance Attribute Summary collapse

Attributes inherited from LoxNode

#position

Instance Method Summary collapse

Methods inherited from LoxNode

#done!

Constructor Details

#initialize(aPosition, aName) ⇒ LoxVariableExpr



14
15
16
17
# File 'lib/loxxy/ast/lox_variable_expr.rb', line 14

def initialize(aPosition, aName)
  super(aPosition)
  @name = aName
end

Instance Attribute Details

#nameString (readonly)



10
11
12
# File 'lib/loxxy/ast/lox_variable_expr.rb', line 10

def name
  @name
end

Instance Method Details

#accept(visitor) ⇒ Object

Part of the 'visitee' role in Visitor design pattern.



21
22
23
# File 'lib/loxxy/ast/lox_variable_expr.rb', line 21

def accept(visitor)
  visitor.visit_variable_expr(self)
end