Class: Koto::Parser::AST::Processor::NameProcessor

Inherits:
Parser::AST::Processor
  • Object
show all
Defined in:
lib/koto/parser/ast/processor/name_processor.rb

Instance Method Summary collapse

Instance Method Details

#on_const(node) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/koto/parser/ast/processor/name_processor.rb', line 9

def on_const(node)
  scope, name = *node
  return name unless scope

  top_level = ::Parser::AST::Node.new(:cbase)

  if scope == top_level
    name = "::#{name}"
  else
    scope = process scope
    name  = "#{scope}::#{name}"
  end

  name.to_sym
end