Remove Engine::custom_types.
This commit is contained in:
@@ -273,7 +273,7 @@ impl Engine {
|
||||
/// ```
|
||||
#[inline(always)]
|
||||
pub fn register_type_with_name<T: Variant + Clone>(&mut self, name: &str) -> &mut Self {
|
||||
self.custom_types.add_type::<T>(name);
|
||||
self.global_namespace_mut().set_custom_type::<T>(name);
|
||||
self
|
||||
}
|
||||
/// Register a custom type for use with the [`Engine`], with a pretty-print name
|
||||
@@ -289,7 +289,8 @@ impl Engine {
|
||||
name: impl Into<Identifier>,
|
||||
) -> &mut Self {
|
||||
// Add the pretty-print type name into the map
|
||||
self.custom_types.add(fully_qualified_type_path, name);
|
||||
self.global_namespace_mut()
|
||||
.set_custom_type_raw(fully_qualified_type_path, name);
|
||||
self
|
||||
}
|
||||
/// Register an type iterator for an iterable type with the [`Engine`].
|
||||
|
@@ -97,7 +97,6 @@ impl Engine {
|
||||
#[cfg(feature = "no_module")]
|
||||
return None;
|
||||
})
|
||||
.or_else(|| self.custom_types.get(name))
|
||||
.unwrap_or_else(|| map_std_type_name(name, true))
|
||||
}
|
||||
|
||||
@@ -119,8 +118,18 @@ impl Engine {
|
||||
};
|
||||
}
|
||||
|
||||
self.custom_types
|
||||
.get(name)
|
||||
self.global_modules
|
||||
.iter()
|
||||
.find_map(|m| m.get_custom_type(name))
|
||||
.or_else(|| {
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
return self
|
||||
.global_sub_modules
|
||||
.iter()
|
||||
.find_map(|(_, m)| m.get_custom_type(name));
|
||||
#[cfg(feature = "no_module")]
|
||||
return None;
|
||||
})
|
||||
.unwrap_or_else(|| match name {
|
||||
"INT" => return type_name::<crate::INT>(),
|
||||
#[cfg(not(feature = "no_float"))]
|
||||
|
Reference in New Issue
Block a user