Class: Loxxy::Ast::LoxLogicalExpr

Inherits:
LoxCompoundExpr show all
Defined in:
lib/loxxy/ast/lox_logical_expr.rb

Instance Attribute Summary collapse

Attributes inherited from LoxCompoundExpr

#subnodes

Attributes inherited from LoxNode

#position

Instance Method Summary collapse

Methods inherited from LoxNode

#done!

Constructor Details

#initialize(aPosition, anOperator, operand1, operand2) ⇒ LoxLogicalExpr

Returns a new instance of LoxLogicalExpr.

Parameters:



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

def initialize(aPosition, anOperator, operand1, operand2)
  super(aPosition, [operand1, operand2])
  @operator = anOperator
end

Instance Attribute Details

#operatorSymbol (readonly)

Returns message name to be sent to receiver.

Returns:

  • (Symbol)

    message name to be sent to receiver



9
10
11
# File 'lib/loxxy/ast/lox_logical_expr.rb', line 9

def operator
  @operator
end

Instance Method Details

#accept(visitor) ⇒ Object

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

Parameters:



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

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