Make merged namespace more efficient.

This commit is contained in:
Stephen Chung
2020-10-02 23:14:33 +08:00
parent 08ca90a136
commit a72f70846f
6 changed files with 57 additions and 56 deletions

View File

@@ -351,10 +351,10 @@ impl CallableFunction {
///
/// Panics if the `CallableFunction` is not `Script`.
#[cfg(not(feature = "no_function"))]
pub fn get_shared_fn_def(&self) -> Shared<ScriptFnDef> {
pub fn get_shared_fn_def(&self) -> &Shared<ScriptFnDef> {
match self {
Self::Pure(_) | Self::Method(_) | Self::Iterator(_) | Self::Plugin(_) => unreachable!(),
Self::Script(f) => f.clone(),
Self::Script(f) => f,
}
}
/// Get a reference to a script-defined function definition.