class Crystal::Program

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

Defined in:

crystalline/ext/compiler.cr:13
crystalline/ext/compiler.cr:99

Instance Method Summary

Instance Method Detail

def error_stack : Set(Crystal::CodeError) #

[View source]
def fail_slow : Bool #

[View source]
def fail_slow=(fail_slow : Bool) #

[View source]
def fail_slow_semantic(node : ASTNode, cleanup = true) : ASTNode #

Will not raise if the semantic analysis fails.


[View source]
def file_overrides : Hash(String, String) | Nil #

Make it possible to compile in-memory.


[View source]
def file_overrides=(file_overrides : Hash(String, String) | Nil) #

Make it possible to compile in-memory.


[View source]