| use crate::syntax::instantiate::NamedImplKey; |
| use crate::syntax::{Lifetimes, NamedType, Pair, Types}; |
| pub struct Resolution<'a> { |
| pub generics: &'a Lifetimes, |
| pub fn resolve(&self, ident: &impl UnresolvedName) -> Resolution<'a> { |
| let ident = ident.ident(); |
| match self.try_resolve(ident) { |
| Some(resolution) => resolution, |
| None => panic!("Unable to resolve type `{}`", ident), |
| pub fn try_resolve(&self, ident: &impl UnresolvedName) -> Option<Resolution<'a>> { |
| let ident = ident.ident(); |
| self.resolutions.get(ident).copied() |
| pub trait UnresolvedName { |
| fn ident(&self) -> &Ident; |
| impl UnresolvedName for Ident { |
| fn ident(&self) -> &Ident { |
| impl UnresolvedName for NamedType { |
| fn ident(&self) -> &Ident { |
| impl<'a> UnresolvedName for NamedImplKey<'a> { |
| fn ident(&self) -> &Ident { |