Sha256: 041b5642c2f2bf4070896bb20f772a5ee11f36dab1d590246aa540fe53170b83

Contents?: true

Size: 674 Bytes

Versions: 12

Compression:

Stored size: 674 Bytes

Contents

# frozen_string_literal: true

require_relative 'lox_compound_expr'

module Loxxy
  module Ast
    class LoxReturnStmt < LoxCompoundExpr
      # @param aPosition [Rley::Lexical::Position] Position of the entry in the input stream.
      # @param anExpression [Ast::LoxNode] expression to return
      def initialize(aPosition, anExpression)
        expr = anExpression || Datatype::Nil.instance
        super(aPosition, [expr])
      end

      # Part of the 'visitee' role in Visitor design pattern.
      # @param visitor [Ast::ASTVisitor] the visitor
      def accept(visitor)
        visitor.visit_return_stmt(self)
      end
    end # class
  end # module
end # module

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
loxxy-0.2.02 lib/loxxy/ast/lox_return_stmt.rb
loxxy-0.2.01 lib/loxxy/ast/lox_return_stmt.rb
loxxy-0.2.00 lib/loxxy/ast/lox_return_stmt.rb
loxxy-0.1.17 lib/loxxy/ast/lox_return_stmt.rb
loxxy-0.1.16 lib/loxxy/ast/lox_return_stmt.rb
loxxy-0.1.15 lib/loxxy/ast/lox_return_stmt.rb
loxxy-0.1.14 lib/loxxy/ast/lox_return_stmt.rb
loxxy-0.1.13 lib/loxxy/ast/lox_return_stmt.rb
loxxy-0.1.12 lib/loxxy/ast/lox_return_stmt.rb
loxxy-0.1.11 lib/loxxy/ast/lox_return_stmt.rb
loxxy-0.1.10 lib/loxxy/ast/lox_return_stmt.rb
loxxy-0.1.09 lib/loxxy/ast/lox_return_stmt.rb