Class: Loxxy::Ast::LoxSetExpr

Inherits:
LoxCompoundExpr show all
Defined in:
lib/loxxy/ast/lox_set_expr.rb

Instance Attribute Summary collapse

Attributes inherited from LoxCompoundExpr

#subnodes

Attributes inherited from LoxNode

#position

Instance Method Summary collapse

Methods inherited from LoxNode

#done!

Constructor Details

#initialize(aPosition, anObject) ⇒ LoxSetExpr

Returns a new instance of LoxSetExpr.

Parameters:

  • aPosition (Rley::Lexical::Position)

    Position of the entry in the input stream.

  • anObject (Ast::LoxNode)

    The object which the given property is being set



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

def initialize(aPosition, anObject)
  super(aPosition, [])
  @object = anObject
end

Instance Attribute Details

#objectAst::LoxNode (readonly)

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_set_expr.rb', line 9

def object
  @object
end

#propertyString

Returns Name of an object property.

Returns:

  • (String)

    Name of an object property



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

def property
  @property
end

Instance Method Details

#accept(visitor) ⇒ Object

Part of the 'visitee' role in Visitor design pattern.

Parameters:



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

def accept(visitor)
  visitor.visit_set_expr(self)
end