Class: NScript::ThisNode

Inherits:
Node
  • Object
show all
Defined in:
lib/nscript/parser/nodes.rb

Constant Summary

Constants inherited from Node

Node::TAB

Instance Method Summary collapse

Methods inherited from Node

#children, children, #compile, #compile_closure, #contains?, #idt, statement, #statement?, statement_only, #statement_only?, top_sensitive, #top_sensitive?, #unwrap, #write

Constructor Details

#initialize(property = nil) ⇒ ThisNode

Returns a new instance of ThisNode.



371
372
373
# File 'lib/nscript/parser/nodes.rb', line 371

def initialize(property=nil)
  @property = property
end

Instance Method Details

#compile_node(o) ⇒ Object



375
376
377
378
# File 'lib/nscript/parser/nodes.rb', line 375

def compile_node(o)
  prop = @property ? ".#{@property}" : ''
  write("this#{prop}")
end