Do not box ModuleRef.
This commit is contained in:
parent
42eac410b7
commit
abbee80e5d
@ -866,7 +866,7 @@ pub struct FnCallInfo {
|
|||||||
/// and the function names are predictable, so no need to allocate a new `String`.
|
/// and the function names are predictable, so no need to allocate a new `String`.
|
||||||
pub name: Cow<'static, str>,
|
pub name: Cow<'static, str>,
|
||||||
/// Namespace of the function, if any.
|
/// Namespace of the function, if any.
|
||||||
pub namespace: Option<Box<ModuleRef>>,
|
pub namespace: Option<ModuleRef>,
|
||||||
/// Call native functions only? Set to `true` to skip searching for script-defined function overrides
|
/// Call native functions only? Set to `true` to skip searching for script-defined function overrides
|
||||||
/// when it is certain that the function must be native (e.g. an operator).
|
/// when it is certain that the function must be native (e.g. an operator).
|
||||||
pub native_only: bool,
|
pub native_only: bool,
|
||||||
@ -904,7 +904,7 @@ pub enum Expr {
|
|||||||
/// FnPtr constant.
|
/// FnPtr constant.
|
||||||
FnPointer(Box<IdentX>),
|
FnPointer(Box<IdentX>),
|
||||||
/// Variable access - ((variable name, position), optional modules, hash, optional index)
|
/// Variable access - ((variable name, position), optional modules, hash, optional index)
|
||||||
Variable(Box<(Ident, Option<Box<ModuleRef>>, u64, Option<NonZeroUsize>)>),
|
Variable(Box<(Ident, Option<ModuleRef>, u64, Option<NonZeroUsize>)>),
|
||||||
/// Property access.
|
/// Property access.
|
||||||
Property(Box<(IdentX, (String, String))>),
|
Property(Box<(IdentX, (String, String))>),
|
||||||
/// { stmt }
|
/// { stmt }
|
||||||
|
@ -589,7 +589,7 @@ fn default_print(_s: &str) {
|
|||||||
pub fn search_imports<'s>(
|
pub fn search_imports<'s>(
|
||||||
mods: &'s Imports,
|
mods: &'s Imports,
|
||||||
state: &mut State,
|
state: &mut State,
|
||||||
modules: &Box<ModuleRef>,
|
modules: &ModuleRef,
|
||||||
) -> Result<&'s Module, Box<EvalAltResult>> {
|
) -> Result<&'s Module, Box<EvalAltResult>> {
|
||||||
let (root, root_pos) = &modules[0];
|
let (root, root_pos) = &modules[0];
|
||||||
|
|
||||||
@ -617,7 +617,7 @@ pub fn search_imports<'s>(
|
|||||||
pub fn search_imports_mut<'s>(
|
pub fn search_imports_mut<'s>(
|
||||||
mods: &'s mut Imports,
|
mods: &'s mut Imports,
|
||||||
state: &mut State,
|
state: &mut State,
|
||||||
modules: &Box<ModuleRef>,
|
modules: &ModuleRef,
|
||||||
) -> Result<&'s mut Module, Box<EvalAltResult>> {
|
) -> Result<&'s mut Module, Box<EvalAltResult>> {
|
||||||
let (root, root_pos) = &modules[0];
|
let (root, root_pos) = &modules[0];
|
||||||
|
|
||||||
|
@ -1094,7 +1094,7 @@ impl Engine {
|
|||||||
state: &mut State,
|
state: &mut State,
|
||||||
lib: &[&Module],
|
lib: &[&Module],
|
||||||
this_ptr: &mut Option<&mut Dynamic>,
|
this_ptr: &mut Option<&mut Dynamic>,
|
||||||
modules: &Option<Box<ModuleRef>>,
|
modules: &Option<ModuleRef>,
|
||||||
name: &str,
|
name: &str,
|
||||||
args_expr: impl AsRef<[Expr]>,
|
args_expr: impl AsRef<[Expr]>,
|
||||||
def_val: Option<bool>,
|
def_val: Option<bool>,
|
||||||
|
@ -265,7 +265,7 @@ fn parse_fn_call(
|
|||||||
lib: &mut FunctionsLib,
|
lib: &mut FunctionsLib,
|
||||||
id: String,
|
id: String,
|
||||||
capture: bool,
|
capture: bool,
|
||||||
mut namespace: Option<Box<ModuleRef>>,
|
mut namespace: Option<ModuleRef>,
|
||||||
settings: ParseSettings,
|
settings: ParseSettings,
|
||||||
) -> Result<Expr, ParseError> {
|
) -> Result<Expr, ParseError> {
|
||||||
let (token, token_pos) = input.peek().unwrap();
|
let (token, token_pos) = input.peek().unwrap();
|
||||||
@ -898,7 +898,7 @@ fn parse_primary(
|
|||||||
} else {
|
} else {
|
||||||
let mut m: ModuleRef = Default::default();
|
let mut m: ModuleRef = Default::default();
|
||||||
m.push((name, pos));
|
m.push((name, pos));
|
||||||
modules = Some(Box::new(m));
|
modules = Some(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
Expr::Variable(Box::new((Ident::new(id2, pos2), modules, 0, index)))
|
Expr::Variable(Box::new((Ident::new(id2, pos2), modules, 0, index)))
|
||||||
|
Loading…
Reference in New Issue
Block a user