Class: Loxxy::Ast::LoxSuperExpr

Inherits:
LoxNode
  • Object
show all
Defined in:
lib/loxxy/ast/lox_super_expr.rb

Instance Attribute Summary collapse

Attributes inherited from LoxNode

#position

Instance Method Summary collapse

Methods inherited from LoxNode

#accept, #done!

Methods included from ASTVisitee

#define_accept, #snake_case

Constructor Details

#initialize(aPosition, aMethodName) ⇒ LoxSuperExpr

Returns a new instance of LoxSuperExpr.

Parameters:

  • aPosition (Rley::Lexical::Position)

    Position of the entry in the input stream.

  • aMethodName (String)

    Name of a method



16
17
18
19
# File 'lib/loxxy/ast/lox_super_expr.rb', line 16

def initialize(aPosition, aMethodName)
  super(aPosition)
  @property = aMethodName
end

Instance Attribute Details

#objectAst::LoxNode

Returns the object to which the property belongs to.

Returns:

  • (Ast::LoxNode)

    the object to which the property belongs to



9
10
11
# File 'lib/loxxy/ast/lox_super_expr.rb', line 9

def object
  @object
end

#propertyString (readonly)

Returns Name of a method name.

Returns:

  • (String)

    Name of a method name



12
13
14
# File 'lib/loxxy/ast/lox_super_expr.rb', line 12

def property
  @property
end

Instance Method Details

#nameString

Quack like a LoxVariableExpr

Returns:

  • (String)

    the super keyword



23
24
25
# File 'lib/loxxy/ast/lox_super_expr.rb', line 23

def name
  'super'
end