Class: Loxxy::Ast::LoxThisExpr

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

Overview

A node in a parse tree that represents the occurrence of 'this' keyword.

Instance Attribute Summary

Attributes inherited from LoxNode

#position

Instance Method Summary collapse

Methods inherited from LoxNode

#done!, #initialize

Constructor Details

This class inherits a constructor from Loxxy::Ast::LoxNode

Instance Method Details

#accept(aVisitor) ⇒ Object

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

Parameters:

  • _visitor (LoxxyTreeVisitor)

    the visitor



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

def accept(aVisitor)
  aVisitor.visit_this_expr(self)
end

#nameString

Duck-typing: behaves like a LoxVarExpr

Returns:

  • (String)

    return the this keyword



11
12
13
# File 'lib/loxxy/ast/lox_this_expr.rb', line 11

def name
  'this'
end