pub struct Compilation {
pub program: Option<Program>,
pub string_table: HashMap<LineId, StringInfo>,
pub declarations: Vec<Declaration>,
pub contains_implicit_string_tags: bool,
pub file_tags: HashMap<String, Vec<String>>,
pub warnings: Vec<Diagnostic>,
pub debug_info: HashMap<String, DebugInfo>,
}Expand description
The result of a compilation.
Instances of this struct are produced as a result of calling Compiler::compile.
§Implementation Notes
In contrast to the original implementation, where this struct was called a CompilationResult, we return
an actual Result, so this type is guaranteed to only hold warnings as opposed to all diagnostics.
Fields§
§program: Option<Program>The compiled Yarn program that the Compiler produced.
produced.
This value will be None if the
Compiler object’s Compiler::compilation_type value was not
CompilationType::FullCompilation
string_table: HashMap<LineId, StringInfo>A dictionary mapping line IDs to StringInfo objects.
The string table contains the extracted line text found in the
provided source code. The keys of this dictionary are the line IDs
for each line - either through explicit line tags indicated through
the #line: tag, or implicitly-generated line IDs that the
compiler added during compilation.
declarations: Vec<Declaration>The collection of variable declarations that were found during compilation.
This value will be empty if the Compiler object’s
CompilationType value was not CompilationType::FullCompilation.
A value indicating whether the compiler had to create line IDs
for lines in the source code that lacked #line: tags.
Every line is required to have a line ID. If a line doesn’t have a
line ID specified in the source code (via a #line: tag), the
compiler will create one.
Implicit line IDs are guaranteed to remain the same between
compilations when the source file does not change. If you want line
IDs to remain the same when the source code may be modified in the
future, add a #line: tag to the line. This may be done by
hand, or added using the [Utility.AddTagsToLines] method.
The collection of file-level tags found in the source code.
The keys of this dictionary are the file names (as
indicated by the File::file_name field
of the Compiler’s Compiler::files collection), and the values are the
file tags associated with that file.
warnings: Vec<Diagnostic>The collection of Diagnostic objects that
describe possible problems that the user should fix,
but do not cause the compilation process to fail.
All diagnostics in this collection have a severity of DiagnosticSeverity::Warning.
If there was an error during compilation, the compilation returns an Err variant containing
error diagnostics instead of this Compilation.
debug_info: HashMap<String, DebugInfo>Trait Implementations§
Source§impl Clone for Compilation
impl Clone for Compilation
Source§fn clone(&self) -> Compilation
fn clone(&self) -> Compilation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Compilation
impl Debug for Compilation
Source§impl Default for Compilation
impl Default for Compilation
Source§fn default() -> Compilation
fn default() -> Compilation
Source§impl PartialEq for Compilation
impl PartialEq for Compilation
impl StructuralPartialEq for Compilation
Auto Trait Implementations§
impl Freeze for Compilation
impl RefUnwindSafe for Compilation
impl Send for Compilation
impl Sync for Compilation
impl Unpin for Compilation
impl UnwindSafe for Compilation
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer