Class: Loxxy::Ast::LoxAssignExpr

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

Overview

This AST node represents the assignment of a value to a variable

Instance Attribute Summary collapse

Attributes inherited from LoxCompoundExpr

#subnodes

Attributes inherited from LoxNode

#position

Instance Method Summary collapse

Methods inherited from LoxCompoundExpr

#accept

Methods inherited from LoxNode

#accept, #done!

Methods included from ASTVisitee

#define_accept, #snake_case

Constructor Details

#initialize(aPosition, aName, aValue) ⇒ LoxAssignExpr

Returns a new instance of LoxAssignExpr.

Parameters:

  • aPosition (Rley::Lexical::Position)

    Position of the entry in the input stream.

  • aName (String)

    name of the variable

  • aValue (Loxxy::Ast::LoxNode, NilClass)

    value to assign



15
16
17
18
# File 'lib/loxxy/ast/lox_assign_expr.rb', line 15

def initialize(aPosition, aName, aValue)
  super(aPosition, [aValue])
  @name = aName
end

Instance Attribute Details

#nameString (readonly)

Returns variable name.

Returns:

  • (String)

    variable name



10
11
12
# File 'lib/loxxy/ast/lox_assign_expr.rb', line 10

def name
  @name
end