module Carbon::Core

The Carbon Core library. This is the library that is loaded for every program, and contains definitions that cannot be defined from within Carbon. The Carbon Core library is required for any Carbon program to function.

@api private

Constants

Ints

The integeral types that are defined in Carbon, and all information pertaining to them.

@return [<Int>]

PATH

Public Class Methods

define(*options, &block) click to toggle source

Defines an item on the core index.

@see .index @see Concrete::Index#define @api semipublic @example (see Concrete::Index#define) @param (see Concrete::Index#define) @yield (see Concrete::Index#define) @yieldparam (see Concrete::Index#define) @raise (see Concrete::Index#define) @return (see Concrete::Index#define)

# File lib/carbon/core.rb, line 34
def self.define(*options, &block)
  index.define(*options, &block)
end
define_main(build, pass) click to toggle source
# File lib/carbon/core.rb, line 49
def self.define_main(build, pass)
  Core::Main.define_main_function(build.module, build.index, pass)
end
finalize() click to toggle source

Finalizes the index by defining all of the types on it.

@api private @return [void]

# File lib/carbon/core.rb, line 42
def self.finalize
  @index = Concrete::Index.new
  Core::Integer.define_integer
  Core::Pointer.define_pointer
  index.finalize
end
find() click to toggle source
# File lib/carbon/core.rb, line 53
def self.find
  if PATH.exist?
    Concrete.load(PATH.read)
  else
    finalize.tap { |i| PATH.write(Concrete.dump(i)) }
  end
end
index() click to toggle source

The core index. This can either be loaded from a core library file or from the definitions in this library.

@return [Concrete::Index] The Carbon Core library index.

# File lib/carbon/core.rb, line 19
def self.index
  @index ||= find
end