Struct galvan_resolver::LookupContext
source · 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>
source§impl LookupContext<'_>
impl LookupContext<'_>
pub fn resolve_type(&self, name: &TypeIdent) -> Option<&ToplevelItem<TypeDecl>>
pub fn resolve_function( &self, receiver: Option<&TypeIdent>, name: &Ident, labels: &[&str] ) -> Option<&ToplevelItem<FnDecl>>
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
Auto Trait Implementations§
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