Remove unnecessary err.fill_position()

This commit is contained in:
Stephen Chung 2021-01-02 13:29:16 +08:00
parent 0a69caaf6d
commit 05fa8460a3
2 changed files with 6 additions and 11 deletions

View File

@ -1182,7 +1182,6 @@ impl Engine {
None, None, level, None, None, level,
) )
.map(|(v, _)| (v, true)) .map(|(v, _)| (v, true))
.map_err(|err| err.fill_position(*pos))
} }
// xxx.id // xxx.id
Expr::Property(x) => { Expr::Property(x) => {
@ -1193,7 +1192,6 @@ impl Engine {
None, None, level, None, None, level,
) )
.map(|(v, _)| (v, false)) .map(|(v, _)| (v, false))
.map_err(|err| err.fill_position(*pos))
} }
// {xxx:map}.sub_lhs[expr] | {xxx:map}.sub_lhs.expr // {xxx:map}.sub_lhs[expr] | {xxx:map}.sub_lhs.expr
Expr::Index(x, x_pos) | Expr::Dot(x, x_pos) if target_val.is::<Map>() => { Expr::Index(x, x_pos) | Expr::Dot(x, x_pos) if target_val.is::<Map>() => {
@ -1244,12 +1242,10 @@ impl Engine {
let (getter, setter, Ident { pos, .. }) = p.as_ref(); let (getter, setter, Ident { pos, .. }) = p.as_ref();
let arg_values = &mut [target_val, &mut Default::default()]; let arg_values = &mut [target_val, &mut Default::default()];
let args = &mut arg_values[..1]; let args = &mut arg_values[..1];
let (mut val, updated) = self let (mut val, updated) = self.exec_fn_call(
.exec_fn_call(
mods, state, lib, getter, None, args, is_ref, true, false, mods, state, lib, getter, None, args, is_ref, true, false,
*pos, None, None, level, *pos, None, None, level,
) )?;
.map_err(|err| err.fill_position(*pos))?;
let val = &mut val; let val = &mut val;
@ -1282,7 +1278,7 @@ impl Engine {
EvalAltResult::ErrorDotExpr(_, _) => { EvalAltResult::ErrorDotExpr(_, _) => {
Ok((Dynamic::UNIT, false)) Ok((Dynamic::UNIT, false))
} }
_ => Err(err.fill_position(*x_pos)), _ => Err(err),
}, },
)?; )?;
} }

View File

@ -395,7 +395,7 @@ impl Module {
} }
/// Get a reference to a namespace-qualified variable. /// Get a reference to a namespace-qualified variable.
/// Name and Position in `EvalAltResult` are None and must be set afterwards. /// Name and Position in [`EvalAltResult`] are [`None`] and [`NONE`][Position::NONE] and must be set afterwards.
/// ///
/// The [`NonZeroU64`] hash is calculated by the function [`crate::calc_native_fn_hash`]. /// The [`NonZeroU64`] hash is calculated by the function [`crate::calc_native_fn_hash`].
#[inline(always)] #[inline(always)]
@ -1420,7 +1420,6 @@ impl Module {
} }
/// Get a namespace-qualified function. /// Get a namespace-qualified function.
/// Name and Position in `EvalAltResult` are None and must be set afterwards.
/// ///
/// The [`NonZeroU64`] hash is calculated by the function [`crate::calc_native_fn_hash`] and must match /// The [`NonZeroU64`] hash is calculated by the function [`crate::calc_native_fn_hash`] and must match
/// the hash calculated by [`build_index`][Module::build_index]. /// the hash calculated by [`build_index`][Module::build_index].