Update get_type to accept imported types as well
This commit is contained in:
parent
269de327b8
commit
19120492b9
@ -156,6 +156,15 @@ impl<Data: Clone + Default> Scope<Data> {
|
|||||||
.find(|(CustomTypeKey(n, _), _)| n == name)
|
.find(|(CustomTypeKey(n, _), _)| n == name)
|
||||||
.map(|(key, _)| key)
|
.map(|(key, _)| key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_type(&self, typekey: &CustomTypeKey) -> Option<&TypeDefinition> {
|
||||||
|
self.types.get(&typekey).or(self
|
||||||
|
.types
|
||||||
|
.0
|
||||||
|
.iter()
|
||||||
|
.find(|(key, def)| key.0 == typekey.0 && def.importer == Some(typekey.1))
|
||||||
|
.map(|(_, v)| v))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -300,8 +300,7 @@ impl TypeKind {
|
|||||||
TypeKind::CustomType(custom_type_key) => {
|
TypeKind::CustomType(custom_type_key) => {
|
||||||
state
|
state
|
||||||
.scope
|
.scope
|
||||||
.types
|
.get_type(custom_type_key)
|
||||||
.get(custom_type_key)
|
|
||||||
.map(|_| ())
|
.map(|_| ())
|
||||||
.ok_or(ErrorKind::NoSuchType(
|
.ok_or(ErrorKind::NoSuchType(
|
||||||
custom_type_key.0.clone(),
|
custom_type_key.0.clone(),
|
||||||
|
Loading…
Reference in New Issue
Block a user