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> 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