Complete StaticVec implementation.

This commit is contained in:
Stephen Chung
2020-05-17 22:19:49 +08:00
parent a2c50879fe
commit 8b5550eeb6
11 changed files with 373 additions and 169 deletions

View File

@@ -330,7 +330,7 @@ impl Stmt {
Stmt::Loop(x) => x.position(),
Stmt::For(x) => x.2.position(),
Stmt::Import(x) => (x.1).1,
Stmt::Export(x) => (x.get_ref(0).0).1,
Stmt::Export(x) => (x.get(0).0).1,
}
}
@@ -745,7 +745,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_ref(0).0));
modules.set_index(stack.find_module(&modules.get(0).0));
// Rust functions are indexed in two steps:
// 1) Calculate a hash in a similar manner to script-defined functions,
@@ -786,7 +786,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_ref(0).0));
modules.set_index(stack.find_module(&modules.get(0).0));
// Rust functions are indexed in two steps:
// 1) Calculate a hash in a similar manner to script-defined functions,
@@ -1251,7 +1251,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_ref(0).0));
modules.set_index(stack.find_module(&modules.get(0).0));
}
_ => (),
}
@@ -1471,7 +1471,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_ref(0).1));
return Err(PERR::PropertyExpected.into_err(x.1.unwrap().get(0).1));
}
// lhs.dot_lhs.dot_rhs
(lhs, Expr::Dot(x)) => {