pub struct LookupContext<'a> {
pub types: HashMap<TypeIdent, &'a ToplevelItem<TypeDecl>>,
pub functions: HashMap<FunctionId, &'a ToplevelItem<FnDecl>>,
pub main: Option<&'a ToplevelItem<MainDecl>>,
}Fields§
§types: HashMap<TypeIdent, &'a ToplevelItem<TypeDecl>>Types are resolved by their name
functions: HashMap<FunctionId, &'a ToplevelItem<FnDecl>>Functions are resolved by their name and - if present - named arguments and their receiver type
fn foo(a: i32, b: i32) -> i32 is identified as foo
fn foo(bar a: i32, b: i32) -> i32 is identified as foo:bar
fn foo(self: i32, b: i32) -> i32 is identified as i32::foo
main: Option<&'a ToplevelItem<MainDecl>>Implementations§
Source§impl<'a> LookupContext<'a>
impl<'a> LookupContext<'a>
pub fn new() -> Self
pub fn add_from(&mut self, asts: &'a SegmentedAsts) -> Result<(), LookupError>
pub fn with(self, asts: &'a SegmentedAsts) -> Result<Self, LookupError>
Trait Implementations§
Source§impl<'a> Clone for LookupContext<'a>
impl<'a> Clone for LookupContext<'a>
Source§fn clone(&self) -> LookupContext<'a>
fn clone(&self) -> LookupContext<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for LookupContext<'a>
impl<'a> Debug for LookupContext<'a>
Source§impl<'a> Default for LookupContext<'a>
impl<'a> Default for LookupContext<'a>
Source§fn default() -> LookupContext<'a>
fn default() -> LookupContext<'a>
Returns the “default value” for a type. Read more
Source§impl Lookup for LookupContext<'_>
impl Lookup for LookupContext<'_>
fn resolve_type(&self, name: &TypeIdent) -> Option<&ToplevelItem<TypeDecl>>
fn resolve_function( &self, receiver: Option<&TypeIdent>, name: &Ident, labels: &[&str], ) -> Option<&ToplevelItem<FnDecl>>
Auto Trait Implementations§
impl<'a> Freeze for LookupContext<'a>
impl<'a> RefUnwindSafe for LookupContext<'a>
impl<'a> Send for LookupContext<'a>
impl<'a> Sync for LookupContext<'a>
impl<'a> Unpin for LookupContext<'a>
impl<'a> UnwindSafe for LookupContext<'a>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more