Class: IdentifierNode

Inherits:
PrimitiveNode show all
Defined in:
lib/nodes.rb

Instance Attribute Summary

Attributes inherited from PrimitiveNode

#value

Instance Method Summary collapse

Methods inherited from PrimitiveNode

#initialize

Constructor Details

This class inherits a constructor from PrimitiveNode

Instance Method Details

#evaluate(scope) ⇒ Object



290
291
292
293
294
295
296
297
298
299
# File 'lib/nodes.rb', line 290

def evaluate(scope)
  if scope.is_function?(@value)
    raise SyntaxError, "Identifier #{@value} is assigned to a function. Please use correct syntax for function call."
  end
  id_value = scope.get_identifier(@value)
  unless scope.identifiers.has_key?(@value)
    scope.set_non_local_variable(@value)
  end
  return id_value
end