Sha256: 6c084ca03370092416ce4f3b1d0f65cf639d984083cff77e6f5e068704189de1

Contents?: true

Size: 906 Bytes

Versions: 3

Compression:

Stored size: 906 Bytes

Contents

# frozen_string_literal: true

require_relative 'lox_compound_expr'

module Loxxy
  module Ast
    # rubocop: disable Style/AccessorGrouping
    class LoxFunStmt < LoxCompoundExpr
      attr_reader :name
      attr_reader :params
      attr_reader :body

      # @param aPosition [Rley::Lexical::Position] Position of the entry in the input stream.
      # @param aName [String]
      # @param arguments [Array<String>]
      # @param body [Ast::LoxBlockStmt]
      def initialize(aPosition, aName, paramList, aBody)
        super(aPosition, [])
        @name = aName
        @params = paramList
        @body = aBody
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loxxy-0.1.10 lib/loxxy/ast/lox_fun_stmt.rb
loxxy-0.1.09 lib/loxxy/ast/lox_fun_stmt.rb
loxxy-0.1.08 lib/loxxy/ast/lox_fun_stmt.rb