class Crystal::Program
- Crystal::Program
- Crystal::NonGenericModuleType
- Crystal::ModuleType
- Crystal::NamedType
- Crystal::Type
- Reference
- Object
Overview
A program contains all types and top-level methods related to one compilation of a program.
It also carries around all information needed to compile a bunch of files: the unions, the symbols used, all global variables, all required files, etc. Because of this, a Program is usually passed around in every step of a compilation to record and query this information.
In a way, a Program is an alternative implementation to having global variables for all of this data, but modeled this way one can easily test and exercise programs because each one has its own definition of the types created, methods instantiated, etc.
Additionally, a Program acts as a regular type (a module) that can have
types (the top-level types) and methods (the top-level methods), and which
can also include other modules (this happens when you do include Module
at the top-level).
Included Modules
- Crystal::DefInstanceContainer
Defined in:
crystalline/ext/compiler.cr:13crystalline/ext/compiler.cr:99
crystalline/ext/compiler.cr:211
Instance Method Summary
-
#crystal_path=(crystal_path : Crystal::CrystalPath | Nil)
Make it possible to use a custom library path.
- #error_stack : Set(Crystal::CodeError)
- #fail_slow : Bool
- #fail_slow=(fail_slow : Bool)
-
#fail_slow_semantic(node : ASTNode, cleanup = true) : ASTNode
Will not raise if the semantic analysis fails.
-
#file_overrides : Hash(String, String) | Nil
Make it possible to compile in-memory.
-
#file_overrides=(file_overrides : Hash(String, String) | Nil)
Make it possible to compile in-memory.
Instance Method Detail
Make it possible to use a custom library path.
Will not raise if the semantic analysis fails.
Make it possible to compile in-memory.