Class: Delorean::NodeAsValueNested

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

Instance Method Summary collapse

Instance Method Details

#check(context) ⇒ Object



205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/delorean/nodes.rb', line 205

def check(context, *)
  module_names = c.text_value.split('::')
  node_name = module_names.pop
  mname = module_names.join('::') if module_names.any?

  begin
    context.parse_check_defined_mod_node(node_name, mname)
  rescue UndefinedError, ParseError
    # Node is a non-Delorean ruby class
    context.parse_class(text_value)
  end
  []
end

#rewrite(context) ⇒ Object



219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/delorean/nodes.rb', line 219

def rewrite(context)
  module_names = c.text_value.split('::')
  node_name = module_names.pop
  mname = module_names.join('::') if module_names.any?

  begin
    context.parse_check_defined_mod_node(node_name, mname)
    context.super_name(node_name, mname)
  rescue UndefinedError, ParseError
    # FIXME: wrap the class name so Call will be able to tell it
    # apart from a regular value.
    ClassText.new(text_value)
  end
end