Class: JSE::Ast::SymbolNode
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from AstNode
Instance Method Summary collapse
- #apply(call_env) ⇒ Object
-
#initialize(name, env) ⇒ SymbolNode
constructor
A new instance of SymbolNode.
- #to_json ⇒ Object
Constructor Details
#initialize(name, env) ⇒ SymbolNode
Returns a new instance of SymbolNode.
21 22 23 24 |
# File 'lib/jse/ast/nodes.rb', line 21 def initialize(name, env) super(env) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
26 27 28 |
# File 'lib/jse/ast/nodes.rb', line 26 def name @name end |
Instance Method Details
#apply(call_env) ⇒ Object
28 29 30 31 32 |
# File 'lib/jse/ast/nodes.rb', line 28 def apply(call_env) val = call_env.resolve(@name) raise NameError, "Symbol '#{@name}' not found" if val.nil? val end |
#to_json ⇒ Object
34 35 36 |
# File 'lib/jse/ast/nodes.rb', line 34 def to_json @name end |