Class: Delorean::Identifier

Inherits:
SNode
  • Object
show all
Defined in:
lib/delorean/nodes.rb

Instance Method Summary collapse

Instance Method Details

#check(context) ⇒ Object



337
338
339
340
# File 'lib/delorean/nodes.rb', line 337

def check(context, *)
  context.parse_call_last_node_attr(text_value)
  [text_value]
end

#rewrite(context) ⇒ Object



342
343
344
345
346
347
348
349
# File 'lib/delorean/nodes.rb', line 342

def rewrite(context)
  # Identifiers are just attr accesses.  These are translated to
  # class method calls.  POST is used in mangling the attr names.
  # _e is the environment.  Comprehension vars (in comp_set) are
  # not passed the env arg.
  arg = context.comp_set.member?(text_value) ? '' : '(_e)'
  text_value + POST + arg
end