Class: Carbon::Compiler::Node::Root

Inherits:
Base
  • Object
show all
Defined in:
lib/carbon/compiler/node/root.rb

Overview

The root node. This is the topmost level node, and includes all declarations, definitions, and directives.

Instance Attribute Summary

Attributes inherited from Base

#children, #location

Instance Method Summary collapse

Methods inherited from Base

#[], #accept, #attributes!, #behavior?, #data, #data?, #each, #identity?, #initialize, #map!, mapping, #merge!, #type!, #update!

Constructor Details

This class inherits a constructor from Carbon::Compiler::Node::Base

Instance Method Details

#inspectObject



17
18
19
# File 'lib/carbon/compiler/node/root.rb', line 17

def inspect
  "#[Module #{name.inspect}]"
end

#nameCarbon::Concrete::Type

The “name” of the root.

Returns:

  • (Carbon::Concrete::Type)


13
14
15
# File 'lib/carbon/compiler/node/root.rb', line 13

def name
  @children.select(&:identity?).last[0]
end