Class: Loxxy::Ast::LoxReturnStmt

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

Instance Attribute Summary

Attributes inherited from LoxCompoundExpr

#subnodes

Attributes inherited from LoxNode

#position

Instance Method Summary collapse

Methods inherited from LoxNode

#done!

Constructor Details

#initialize(aPosition, anExpression) ⇒ LoxReturnStmt

Returns a new instance of LoxReturnStmt.

Parameters:

  • aPosition (Rley::Lexical::Position)

    Position of the entry in the input stream.

  • anExpression (Ast::LoxNode)

    expression to return



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

def initialize(aPosition, anExpression)
  expr = anExpression || Datatype::Nil.instance
  super(aPosition, [expr])
end

Instance Method Details

#accept(visitor) ⇒ Object

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

Parameters:



17
18
19
# File 'lib/loxxy/ast/lox_return_stmt.rb', line 17

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