Sha256: efbc1ceb4630898bf3349ee0fd04a3f9a06265454df425f9fc0cae8708fb42a7

Contents?: true

Size: 869 Bytes

Versions: 5

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true

require_relative 'lox_compound_expr'

module Loxxy
  module Ast
    class LoxClassStmt < LoxCompoundExpr
      # @return [String] the class name
      attr_reader :name

      # @return [Array<Ast::LoxFunStmt>] the methods
      attr_reader :body

      # @param aPosition [Rley::Lexical::Position] Position of the entry in the input stream.
      # @param condExpr [Loxxy::Ast::LoxNode] iteration condition
      # @param theBody [Array<Loxxy::Ast::LoxNode>]
      def initialize(aPosition, aName, theMethods)
        super(aPosition, [])
        @name = aName.dup
        @body = theMethods
      end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
loxxy-0.1.17 lib/loxxy/ast/lox_class_stmt.rb
loxxy-0.1.16 lib/loxxy/ast/lox_class_stmt.rb
loxxy-0.1.15 lib/loxxy/ast/lox_class_stmt.rb
loxxy-0.1.14 lib/loxxy/ast/lox_class_stmt.rb
loxxy-0.1.13 lib/loxxy/ast/lox_class_stmt.rb