Class: NScript::AccessorNode

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

Constant Summary

Constants inherited from Node

Node::TAB

Instance Attribute Summary collapse

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(name, tag = nil) ⇒ AccessorNode

Returns a new instance of AccessorNode.



346
347
348
349
350
# File 'lib/nscript/parser/nodes.rb', line 346

def initialize(name, tag=nil)
  @name       = name
  @prototype  = tag == :prototype
  @soak       = tag == :soak
end

Instance Attribute Details

#soakObject (readonly)

Returns the value of attribute soak.



344
345
346
# File 'lib/nscript/parser/nodes.rb', line 344

def soak
  @soak
end

Instance Method Details

#compile_node(o) ⇒ Object



352
353
354
355
# File 'lib/nscript/parser/nodes.rb', line 352

def compile_node(o)
  proto = @prototype ? "prototype." : ''
  write(".#{proto}#{@name}")
end