Sha256: c7534adb4afa4de1e249578763f891fa169fca9d48eb8a1d89c793ee764d3955

Contents?: true

Size: 926 Bytes

Versions: 8

Compression:

Stored size: 926 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 [Ast::LoxVariableExpr] variable referencing the superclass (if any)
      attr_reader :superclass

      # @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, aSuperclassName, theMethods)
        super(aPosition, [])
        @name = aName.dup
        @superclass = aSuperclassName
        @body = theMethods
      end

      define_accept # Add `accept` method as found in Visitor design pattern
    end # class
  end # module
end # module

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
loxxy-0.3.03 lib/loxxy/ast/lox_class_stmt.rb
loxxy-0.3.02 lib/loxxy/ast/lox_class_stmt.rb
loxxy-0.3.01 lib/loxxy/ast/lox_class_stmt.rb
loxxy-0.3.00 lib/loxxy/ast/lox_class_stmt.rb
loxxy-0.2.06 lib/loxxy/ast/lox_class_stmt.rb
loxxy-0.2.05 lib/loxxy/ast/lox_class_stmt.rb
loxxy-0.2.04 lib/loxxy/ast/lox_class_stmt.rb
loxxy-0.2.03 lib/loxxy/ast/lox_class_stmt.rb