Class: Delorean::Identifier

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

Instance Method Summary collapse

Instance Method Details

#check(context) ⇒ Object



339
340
341
342
# File 'lib/delorean/nodes.rb', line 339

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

#rewrite(context) ⇒ Object



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

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