Use StaticVec to avoid most allocations with function arguments.
This commit is contained in:
@@ -724,7 +724,7 @@ fn parse_call_expr<'a>(
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
let hash_fn_def = {
|
||||
if let Some(modules) = modules.as_mut() {
|
||||
modules.set_index(stack.find_module(&modules.get(0).0));
|
||||
modules.set_index(stack.find_module(&modules.get_ref(0).0));
|
||||
|
||||
// Rust functions are indexed in two steps:
|
||||
// 1) Calculate a hash in a similar manner to script-defined functions,
|
||||
@@ -764,7 +764,7 @@ fn parse_call_expr<'a>(
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
let hash_fn_def = {
|
||||
if let Some(modules) = modules.as_mut() {
|
||||
modules.set_index(stack.find_module(&modules.get(0).0));
|
||||
modules.set_index(stack.find_module(&modules.get_ref(0).0));
|
||||
|
||||
// Rust functions are indexed in two steps:
|
||||
// 1) Calculate a hash in a similar manner to script-defined functions,
|
||||
@@ -1238,7 +1238,7 @@ fn parse_primary<'a>(
|
||||
|
||||
// Qualifiers + variable name
|
||||
*hash = calc_fn_hash(modules.iter().map(|(v, _)| v.as_str()), name, empty());
|
||||
modules.set_index(stack.find_module(&modules.get(0).0));
|
||||
modules.set_index(stack.find_module(&modules.get_ref(0).0));
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
@@ -1446,7 +1446,7 @@ fn make_dot_expr(
|
||||
#[cfg(feature = "no_module")]
|
||||
unreachable!();
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
return Err(PERR::PropertyExpected.into_err(x.1.unwrap().get(0).1));
|
||||
return Err(PERR::PropertyExpected.into_err(x.1.unwrap().get_ref(0).1));
|
||||
}
|
||||
// lhs.dot_lhs.dot_rhs
|
||||
(lhs, Expr::Dot(x)) => {
|
||||
|
Reference in New Issue
Block a user