Class: EleetScript::SetLocalNode

Inherits:
SetVarNode show all
Defined in:
lib/lang/nodes.rb,
lib/lang/interpreter.rb

Instance Method Summary collapse

Methods inherited from SetVarNode

#to_s

Instance Method Details

#eval(context) ⇒ Object



178
179
180
181
182
183
184
# File 'lib/lang/interpreter.rb', line 178

def eval(context)
  if Lexer::RESERVED_WORDS.include?(name)
    Helpers.throw_eleet_error(context, "Cannot assign a value to reserved word \"#{name}\"")
  else
    context.local_var(name, value.eval(context))
  end
end