pub struct ResolveContext { /* private fields */ }Expand description
Resolve Context
Implementations§
Source§impl ResolveContext
impl ResolveContext
Sourcepub fn new(
root: Rc<SourceFile>,
search_paths: &[impl AsRef<Path>],
diag: DiagHandler,
) -> ResolveResult<Self>
pub fn new( root: Rc<SourceFile>, search_paths: &[impl AsRef<Path>], diag: DiagHandler, ) -> ResolveResult<Self>
Create new context from source file.
Just reads the syntax and does not create any symbols nor resolves anything.
Sourcepub fn create(
root: Rc<SourceFile>,
search_paths: &[impl AsRef<Path>],
builtin: Option<Symbol>,
diag: DiagHandler,
) -> ResolveResult<Self>
pub fn create( root: Rc<SourceFile>, search_paths: &[impl AsRef<Path>], builtin: Option<Symbol>, diag: DiagHandler, ) -> ResolveResult<Self>
Load resolve and check a source file and referenced files.
Sourcepub fn check(&mut self) -> ResolveResult<()>
pub fn check(&mut self) -> ResolveResult<()>
check names in all symbols
Sourcepub fn symbolize_file(
&mut self,
visibility: Visibility,
parent_path: impl AsRef<Path>,
id: &Identifier,
) -> ResolveResult<Symbol>
pub fn symbolize_file( &mut self, visibility: Visibility, parent_path: impl AsRef<Path>, id: &Identifier, ) -> ResolveResult<Symbol>
Load file into source cache and symbolize it into a symbol.
Sourcepub fn is_checked(&self) -> bool
pub fn is_checked(&self) -> bool
Create a symbol out of all sources (without resolving them)
Return true if context has been resolved (or checked as well)
Sourcepub fn reload_files(&mut self, files: &[impl AsRef<Path>]) -> ResolveResult<()>
pub fn reload_files(&mut self, files: &[impl AsRef<Path>]) -> ResolveResult<()>
Reload one or more existing files and re-resolve the symbol table.
Sourcepub fn symbol_table(&self) -> &SymbolTable
pub fn symbol_table(&self) -> &SymbolTable
Symbol table accessor.
Trait Implementations§
Source§impl Debug for ResolveContext
impl Debug for ResolveContext
Source§impl Default for ResolveContext
impl Default for ResolveContext
Source§fn default() -> ResolveContext
fn default() -> ResolveContext
Returns the “default value” for a type. Read more
Source§impl Diag for ResolveContext
impl Diag for ResolveContext
Source§fn fmt_diagnosis(&self, f: &mut dyn Write) -> Result
fn fmt_diagnosis(&self, f: &mut dyn Write) -> Result
Pretty print all errors.
Source§fn warning_count(&self) -> u32
fn warning_count(&self) -> u32
Return number of occurred warnings.
Source§fn error_count(&self) -> u32
fn error_count(&self) -> u32
Return number of occurred errors.
Source§fn error_lines(&self) -> HashSet<usize>
fn error_lines(&self) -> HashSet<usize>
Return all lines with errors
Source§fn warning_lines(&self) -> HashSet<usize>
fn warning_lines(&self) -> HashSet<usize>
Return all lines with warnings
Source§fn write_diagnosis(&self, w: &mut dyn Write) -> Result<()>
fn write_diagnosis(&self, w: &mut dyn Write) -> Result<()>
Pretty write all errors into a file.
Source§fn has_warnings(&self) -> bool
fn has_warnings(&self) -> bool
Returns true if there are warnings.
Source§fn has_errors(&self) -> bool
fn has_errors(&self) -> bool
Returns true if there are errors.
Source§impl Display for ResolveContext
impl Display for ResolveContext
Source§impl GetSourceByHash for ResolveContext
impl GetSourceByHash for ResolveContext
Source§fn get_by_hash(&self, hash: u64) -> ResolveResult<Rc<SourceFile>>
fn get_by_hash(&self, hash: u64) -> ResolveResult<Rc<SourceFile>>
Find a project file by it’s hash value.
Source§impl PushDiag for ResolveContext
impl PushDiag for ResolveContext
Source§fn push_diag(&mut self, diag: Diagnostic) -> DiagResult<()>
fn push_diag(&mut self, diag: Diagnostic) -> DiagResult<()>
Push a diagnostic message (must be implemented).
Source§fn trace(&mut self, src: &impl SrcReferrer, message: String)
fn trace(&mut self, src: &impl SrcReferrer, message: String)
Push new trace message.
Source§fn info(&mut self, src: &impl SrcReferrer, message: String)
fn info(&mut self, src: &impl SrcReferrer, message: String)
Push new informative message.
Source§fn warning(
&mut self,
src: &impl SrcReferrer,
err: impl Error + 'static,
) -> DiagResult<()>
fn warning( &mut self, src: &impl SrcReferrer, err: impl Error + 'static, ) -> DiagResult<()>
Push new warning.
Source§fn error(
&mut self,
src: &impl SrcReferrer,
err: impl Error + 'static,
) -> DiagResult<()>
fn error( &mut self, src: &impl SrcReferrer, err: impl Error + 'static, ) -> DiagResult<()>
Push new error.
Source§impl WriteToFile for ResolveContext
impl WriteToFile for ResolveContext
Auto Trait Implementations§
impl Freeze for ResolveContext
impl !RefUnwindSafe for ResolveContext
impl !Send for ResolveContext
impl !Sync for ResolveContext
impl Unpin for ResolveContext
impl !UnwindSafe for ResolveContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more