Sha256: f2132db0be87a97028972a3313080b74ab16b42830967bce2fa1eba2aa8c0d5b

Contents?: true

Size: 940 Bytes

Versions: 3

Compression:

Stored size: 940 Bytes

Contents

# frozen_string_literal: true

require_relative 'lox_node'

module Loxxy
  module Ast
    class LoxSuperExpr < LoxNode
      # @return [Ast::LoxNode] the object to which the property belongs to
      attr_accessor :object

      # @return [String] Name of a method name
      attr_reader :property

      # @param aPosition [Rley::Lexical::Position] Position of the entry in the input stream.
      # @param aMethodName [String] Name of a method
      def initialize(aPosition, aMethodName)
        super(aPosition)
        @property = aMethodName
      end

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

      # Quack like a LoxVariableExpr
      # @return [String] the `super` keyword
      def name
        'super'
      end
      alias callee= object=
    end # class
  end # module
end # module

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loxxy-0.2.02 lib/loxxy/ast/lox_super_expr.rb
loxxy-0.2.01 lib/loxxy/ast/lox_super_expr.rb
loxxy-0.2.00 lib/loxxy/ast/lox_super_expr.rb