pub struct CompilationState {
pub ast: Ast,
pub diagnostics: Diagnostics,
pub files: Vec<SliceFile>,
}Fields§
§ast: Ast§diagnostics: Diagnostics§files: Vec<SliceFile>Implementations§
Source§impl CompilationState
impl CompilationState
pub fn create() -> Self
Sourcepub fn apply(&mut self, function: fn(&mut Self))
pub fn apply(&mut self, function: fn(&mut Self))
Calls the provided function on this CompilationState if and only if no errors have been reported so far.
If any errors are present in this CompilationState’s Diagnostics container, this is no-op.
Sourcepub unsafe fn apply_unsafe(&mut self, function: unsafe fn(&mut Self))
pub unsafe fn apply_unsafe(&mut self, function: unsafe fn(&mut Self))
Calls the provided function on this CompilationState if and only if no errors have been reported so far.
If any errors are present in this CompilationState’s Diagnostics container, this is no-op.
§Safety
The caller of this function must ensure that no (WeakPtrs)crate::utils::ptr_util::WeakPtr exist that point
to the contents of this CompilationState. Even if they’re not being actively used, their existence causes UB.
Sourcepub fn emit_diagnostics(self, options: &SliceOptions) -> bool
pub fn emit_diagnostics(self, options: &SliceOptions) -> bool
This function is the exit point of the compiler. It emits diagnostics to the console, along with the total number of warning/errors emitted. After this it returns whether any errors were emitted.
Sourcepub fn into_diagnostics(self, options: &SliceOptions) -> Vec<Diagnostic>
pub fn into_diagnostics(self, options: &SliceOptions) -> Vec<Diagnostic>
Consumes this CompilationState and returns the diagnostics it contains.
This method exists to simplify the testing of diagnostic emission.