pub struct CompilationUnit { /* private fields */ }
Expand description
CompilationUnit
identifies an AS3 compilation unit and contains
a source text.
Implementations§
Source§impl CompilationUnit
impl CompilationUnit
Sourcepub fn new(file_path: Option<String>, text: String) -> Rc<Self>
pub fn new(file_path: Option<String>, text: String) -> Rc<Self>
Constructs a source file in unparsed and non verified state.
Sourcepub fn compiler_options(&self) -> Option<Rc<dyn Any>>
pub fn compiler_options(&self) -> Option<Rc<dyn Any>>
Compiler options.
Sourcepub fn set_compiler_options(&self, options: Option<Rc<dyn Any>>)
pub fn set_compiler_options(&self, options: Option<Rc<dyn Any>>)
Set compiler options.
Sourcepub fn invalidated(&self) -> bool
pub fn invalidated(&self) -> bool
Whether the source contains any errors after parsing and/or verification.
Sourcepub fn comments(&self) -> Vec<Rc<Comment>>
pub fn comments(&self) -> Vec<Rc<Comment>>
The comments present in the source file. To get mutable access to the
collection of comments, use the comments_mut()
method instead.
Sourcepub fn comments_mut(&self) -> RefMut<'_, Vec<Rc<Comment>>>
pub fn comments_mut(&self) -> RefMut<'_, Vec<Rc<Comment>>>
The comments present in the source file, as a mutable collection.
Sourcepub fn add_comment(&self, comment: Rc<Comment>)
pub fn add_comment(&self, comment: Rc<Comment>)
Contributes a comment if there is no other comment in the same location.
Sourcepub fn diagnostics(&self) -> Vec<Diagnostic>
pub fn diagnostics(&self) -> Vec<Diagnostic>
Diagnostics of the source file after parsing and/or verification.
Sourcepub fn nested_diagnostics(&self) -> Vec<Diagnostic>
pub fn nested_diagnostics(&self) -> Vec<Diagnostic>
Diagnostics of the source file after parsing and/or verification, including those of nested compilation units.
Sourcepub fn sort_diagnostics(&self)
pub fn sort_diagnostics(&self)
Sort diagnostics from the compilation unit and any nested compilation units.
Sourcepub fn prevent_equal_offset_error(&self, location: &Location) -> bool
pub fn prevent_equal_offset_error(&self, location: &Location) -> bool
Determines whether to skip contributing an error when it occurs at the same offset of another error.
Sourcepub fn prevent_equal_offset_warning(&self, location: &Location) -> bool
pub fn prevent_equal_offset_warning(&self, location: &Location) -> bool
Determines whether to skip contributing a warning when it occurs at the same offset of another warning.
Sourcepub fn included_from(&self) -> Option<Rc<CompilationUnit>>
pub fn included_from(&self) -> Option<Rc<CompilationUnit>>
If this compilation unit is subsequent of an include directive in another compilation unit, returns the compilation unit of that include directive.
pub fn nested_compilation_units(&self) -> Vec<Rc<CompilationUnit>>
pub fn add_nested_compilation_unit(self: &Rc<Self>, unit: Rc<CompilationUnit>)
pub fn add_diagnostic(&self, diagnostic: Diagnostic)
pub fn error_count(&self) -> u32
pub fn warning_count(&self) -> u32
Sourcepub fn get_line_number(&self, offset: usize) -> usize
pub fn get_line_number(&self, offset: usize) -> usize
Retrieves line number from an offset. The resulting line number is counted from one.
Sourcepub fn get_column(&self, offset: usize) -> usize
pub fn get_column(&self, offset: usize) -> usize
Returns the zero based column of an offset.
Sourcepub fn get_line_offset(&self, line: usize) -> Option<usize>
pub fn get_line_offset(&self, line: usize) -> Option<usize>
Retrieves offset from line number (counted from one).
Sourcepub fn get_line_offset_from_offset(&self, offset: usize) -> usize
pub fn get_line_offset_from_offset(&self, offset: usize) -> usize
Retrieves the offset from the corresponding line of an offset.