Class: Carbon::Compiler::Project
- Inherits:
-
Object
- Object
- Carbon::Compiler::Project
- Defined in:
- lib/carbon/compiler/project.rb,
lib/carbon/compiler/project/file.rb
Defined Under Namespace
Classes: File
Instance Attribute Summary collapse
-
#diagnostics ⇒ Object
readonly
Returns the value of attribute diagnostics.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#main ⇒ Object
readonly
Returns the value of attribute main.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(files, root, libraries: []) ⇒ Project
constructor
A new instance of Project.
Constructor Details
#initialize(files, root, libraries: []) ⇒ Project
Returns a new instance of Project.
15 16 17 18 19 20 21 |
# File 'lib/carbon/compiler/project.rb', line 15 def initialize(files, root, libraries: []) @root = Pathname.new(root).(Dir.pwd) @files = files.map { |f| Project::File.new(f, @root, self) } @diagnostics = Metanostic::List.new @libraries = [] @files.each { |f| @diagnostics.files[f.short] = f } end |
Instance Attribute Details
#diagnostics ⇒ Object (readonly)
Returns the value of attribute diagnostics.
11 12 13 |
# File 'lib/carbon/compiler/project.rb', line 11 def diagnostics @diagnostics end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
12 13 14 |
# File 'lib/carbon/compiler/project.rb', line 12 def items @items end |
#main ⇒ Object (readonly)
Returns the value of attribute main.
13 14 15 |
# File 'lib/carbon/compiler/project.rb', line 13 def main @main end |
Instance Method Details
#call ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/carbon/compiler/project.rb', line 23 def call @index ||= begin @index = Concrete::Index.new @files.each { |f| f.call(@index, @diagnostics.clone) } # load libraries... @libraries.each do |library| @index.link(Carbon::Concrete.load(::File.read(library, "rb"))) end @index.link(Carbon::Core.index) @index.finalize end end |