Make parameters order uniform.
This commit is contained in:
@@ -41,6 +41,7 @@ impl Engine {
|
||||
global: &mut GlobalRuntimeState,
|
||||
caches: &mut Caches,
|
||||
lib: &[&Module],
|
||||
level: usize,
|
||||
this_ptr: &mut Option<&mut Dynamic>,
|
||||
target: &mut Target,
|
||||
root: (&str, Position),
|
||||
@@ -49,7 +50,6 @@ impl Engine {
|
||||
rhs: &Expr,
|
||||
idx_values: &mut FnArgsVec<Dynamic>,
|
||||
chain_type: ChainType,
|
||||
level: usize,
|
||||
new_val: &mut Option<(Dynamic, &OpAssignment)>,
|
||||
) -> RhaiResultOf<(Dynamic, bool)> {
|
||||
let is_ref_mut = target.is_ref();
|
||||
@@ -73,7 +73,7 @@ impl Engine {
|
||||
if !parent_options.contains(ASTFlags::BREAK) =>
|
||||
{
|
||||
#[cfg(feature = "debugging")]
|
||||
self.run_debugger(scope, global, lib, this_ptr, _parent, level)?;
|
||||
self.run_debugger(global, caches, lib, level, scope, this_ptr, _parent)?;
|
||||
|
||||
let idx_val = &mut idx_values.pop().unwrap();
|
||||
let mut idx_val_for_setter = idx_val.clone();
|
||||
@@ -82,14 +82,14 @@ impl Engine {
|
||||
|
||||
let (try_setter, result) = {
|
||||
let mut obj = self.get_indexed_mut(
|
||||
global, caches, lib, target, idx_val, idx_pos, false, true, level,
|
||||
global, caches, lib, level, target, idx_val, idx_pos, false, true,
|
||||
)?;
|
||||
let is_obj_temp_val = obj.is_temp_value();
|
||||
let obj_ptr = &mut obj;
|
||||
|
||||
match self.eval_dot_index_chain_helper(
|
||||
global, caches, lib, this_ptr, obj_ptr, root, rhs, *options,
|
||||
&x.rhs, idx_values, rhs_chain, level, new_val,
|
||||
global, caches, lib, level, this_ptr, obj_ptr, root, rhs, *options,
|
||||
&x.rhs, idx_values, rhs_chain, new_val,
|
||||
) {
|
||||
Ok((result, true)) if is_obj_temp_val => {
|
||||
(Some(obj.take_or_clone()), (result, true))
|
||||
@@ -104,7 +104,7 @@ impl Engine {
|
||||
let idx = &mut idx_val_for_setter;
|
||||
let new_val = &mut new_val;
|
||||
self.call_indexer_set(
|
||||
global, caches, lib, target, idx, new_val, is_ref_mut, level,
|
||||
global, caches, lib, level, target, idx, new_val, is_ref_mut,
|
||||
)
|
||||
.or_else(|e| match *e {
|
||||
ERR::ErrorIndexingType(..) => Ok((Dynamic::UNIT, false)),
|
||||
@@ -117,19 +117,19 @@ impl Engine {
|
||||
// xxx[rhs] op= new_val
|
||||
_ if new_val.is_some() => {
|
||||
#[cfg(feature = "debugging")]
|
||||
self.run_debugger(scope, global, lib, this_ptr, _parent, level)?;
|
||||
self.run_debugger(global, caches, lib, level, scope, this_ptr, _parent)?;
|
||||
|
||||
let (new_val, op_info) = new_val.take().expect("`Some`");
|
||||
let idx_val = &mut idx_values.pop().unwrap();
|
||||
let idx = &mut idx_val.clone();
|
||||
|
||||
let try_setter = match self.get_indexed_mut(
|
||||
global, caches, lib, target, idx, pos, true, false, level,
|
||||
global, caches, lib, level, target, idx, pos, true, false,
|
||||
) {
|
||||
// Indexed value is not a temp value - update directly
|
||||
Ok(ref mut obj_ptr) => {
|
||||
self.eval_op_assignment(
|
||||
global, caches, lib, op_info, obj_ptr, root, new_val, level,
|
||||
global, caches, lib, level, op_info, obj_ptr, root, new_val,
|
||||
)?;
|
||||
self.check_data_size(obj_ptr, op_info.pos)?;
|
||||
None
|
||||
@@ -148,13 +148,13 @@ impl Engine {
|
||||
|
||||
// Call the index getter to get the current value
|
||||
if let Ok(val) =
|
||||
self.call_indexer_get(global, caches, lib, target, idx, level)
|
||||
self.call_indexer_get(global, caches, lib, level, target, idx)
|
||||
{
|
||||
let mut val = val.into();
|
||||
// Run the op-assignment
|
||||
self.eval_op_assignment(
|
||||
global, caches, lib, op_info, &mut val, root, new_val,
|
||||
level,
|
||||
global, caches, lib, level, op_info, &mut val, root,
|
||||
new_val,
|
||||
)?;
|
||||
// Replace new value
|
||||
new_val = val.take_or_clone();
|
||||
@@ -166,7 +166,7 @@ impl Engine {
|
||||
let new_val = &mut new_val;
|
||||
|
||||
self.call_indexer_set(
|
||||
global, caches, lib, target, idx_val, new_val, is_ref_mut, level,
|
||||
global, caches, lib, level, target, idx_val, new_val, is_ref_mut,
|
||||
)?;
|
||||
}
|
||||
|
||||
@@ -175,12 +175,12 @@ impl Engine {
|
||||
// xxx[rhs]
|
||||
_ => {
|
||||
#[cfg(feature = "debugging")]
|
||||
self.run_debugger(scope, global, lib, this_ptr, _parent, level)?;
|
||||
self.run_debugger(global, caches, lib, level, scope, this_ptr, _parent)?;
|
||||
|
||||
let idx_val = &mut idx_values.pop().unwrap();
|
||||
|
||||
self.get_indexed_mut(
|
||||
global, caches, lib, target, idx_val, pos, false, true, level,
|
||||
global, caches, lib, level, target, idx_val, pos, false, true,
|
||||
)
|
||||
.map(|v| (v.take_or_clone(), false))
|
||||
}
|
||||
@@ -198,8 +198,9 @@ impl Engine {
|
||||
// xxx.fn_name(arg_expr_list)
|
||||
Expr::MethodCall(x, pos) if !x.is_qualified() && new_val.is_none() => {
|
||||
#[cfg(feature = "debugging")]
|
||||
let reset_debugger =
|
||||
self.run_debugger_with_reset(scope, global, lib, this_ptr, rhs, level)?;
|
||||
let reset_debugger = self.run_debugger_with_reset(
|
||||
global, caches, lib, level, scope, this_ptr, rhs,
|
||||
)?;
|
||||
|
||||
let crate::ast::FnCallExpr {
|
||||
name, hashes, args, ..
|
||||
@@ -210,8 +211,8 @@ impl Engine {
|
||||
let pos1 = args.get(0).map_or(Position::NONE, Expr::position);
|
||||
|
||||
let result = self.make_method_call(
|
||||
global, caches, lib, name, *hashes, target, call_args, pos1, *pos,
|
||||
level,
|
||||
global, caches, lib, level, name, *hashes, target, call_args, pos1,
|
||||
*pos,
|
||||
);
|
||||
|
||||
idx_values.truncate(offset);
|
||||
@@ -232,16 +233,16 @@ impl Engine {
|
||||
// {xxx:map}.id op= ???
|
||||
Expr::Property(x, pos) if target.is::<crate::Map>() && new_val.is_some() => {
|
||||
#[cfg(feature = "debugging")]
|
||||
self.run_debugger(scope, global, lib, this_ptr, rhs, level)?;
|
||||
self.run_debugger(global, caches, lib, level, scope, this_ptr, rhs)?;
|
||||
|
||||
let index = &mut x.2.clone().into();
|
||||
let (new_val, op_info) = new_val.take().expect("`Some`");
|
||||
{
|
||||
let val_target = &mut self.get_indexed_mut(
|
||||
global, caches, lib, target, index, *pos, true, false, level,
|
||||
global, caches, lib, level, target, index, *pos, true, false,
|
||||
)?;
|
||||
self.eval_op_assignment(
|
||||
global, caches, lib, op_info, val_target, root, new_val, level,
|
||||
global, caches, lib, level, op_info, val_target, root, new_val,
|
||||
)?;
|
||||
}
|
||||
self.check_data_size(target.source(), op_info.pos)?;
|
||||
@@ -250,18 +251,18 @@ impl Engine {
|
||||
// {xxx:map}.id
|
||||
Expr::Property(x, pos) if target.is::<crate::Map>() => {
|
||||
#[cfg(feature = "debugging")]
|
||||
self.run_debugger(scope, global, lib, this_ptr, rhs, level)?;
|
||||
self.run_debugger(global, caches, lib, level, scope, this_ptr, rhs)?;
|
||||
|
||||
let index = &mut x.2.clone().into();
|
||||
let val = self.get_indexed_mut(
|
||||
global, caches, lib, target, index, *pos, false, false, level,
|
||||
global, caches, lib, level, target, index, *pos, false, false,
|
||||
)?;
|
||||
Ok((val.take_or_clone(), false))
|
||||
}
|
||||
// xxx.id op= ???
|
||||
Expr::Property(x, pos) if new_val.is_some() => {
|
||||
#[cfg(feature = "debugging")]
|
||||
self.run_debugger(scope, global, lib, this_ptr, rhs, level)?;
|
||||
self.run_debugger(global, caches, lib, level, scope, this_ptr, rhs)?;
|
||||
|
||||
let ((getter, hash_get), (setter, hash_set), name) = &**x;
|
||||
let (mut new_val, op_info) = new_val.take().expect("`Some`");
|
||||
@@ -270,15 +271,15 @@ impl Engine {
|
||||
let args = &mut [target.as_mut()];
|
||||
let (mut orig_val, ..) = self
|
||||
.exec_native_fn_call(
|
||||
global, caches, lib, getter, None, *hash_get, args, is_ref_mut,
|
||||
*pos, level,
|
||||
global, caches, lib, level, getter, None, *hash_get, args,
|
||||
is_ref_mut, *pos,
|
||||
)
|
||||
.or_else(|err| match *err {
|
||||
// Try an indexer if property does not exist
|
||||
ERR::ErrorDotExpr(..) => {
|
||||
let mut prop = name.into();
|
||||
self.call_indexer_get(
|
||||
global, caches, lib, target, &mut prop, level,
|
||||
global, caches, lib, level, target, &mut prop,
|
||||
)
|
||||
.map(|r| (r, false))
|
||||
.map_err(|e| {
|
||||
@@ -295,7 +296,7 @@ impl Engine {
|
||||
let orig_val = &mut (&mut orig_val).into();
|
||||
|
||||
self.eval_op_assignment(
|
||||
global, caches, lib, op_info, orig_val, root, new_val, level,
|
||||
global, caches, lib, level, op_info, orig_val, root, new_val,
|
||||
)?;
|
||||
}
|
||||
|
||||
@@ -304,8 +305,8 @@ impl Engine {
|
||||
|
||||
let args = &mut [target.as_mut(), &mut new_val];
|
||||
self.exec_native_fn_call(
|
||||
global, caches, lib, setter, None, *hash_set, args, is_ref_mut, *pos,
|
||||
level,
|
||||
global, caches, lib, level, setter, None, *hash_set, args, is_ref_mut,
|
||||
*pos,
|
||||
)
|
||||
.or_else(|err| match *err {
|
||||
// Try an indexer if property does not exist
|
||||
@@ -313,7 +314,7 @@ impl Engine {
|
||||
let idx = &mut name.into();
|
||||
let new_val = &mut new_val;
|
||||
self.call_indexer_set(
|
||||
global, caches, lib, target, idx, new_val, is_ref_mut, level,
|
||||
global, caches, lib, level, target, idx, new_val, is_ref_mut,
|
||||
)
|
||||
.map_err(|e| match *e {
|
||||
ERR::ErrorIndexingType(..) => err,
|
||||
@@ -326,13 +327,13 @@ impl Engine {
|
||||
// xxx.id
|
||||
Expr::Property(x, pos) => {
|
||||
#[cfg(feature = "debugging")]
|
||||
self.run_debugger(scope, global, lib, this_ptr, rhs, level)?;
|
||||
self.run_debugger(global, caches, lib, level, scope, this_ptr, rhs)?;
|
||||
|
||||
let ((getter, hash_get), _, name) = &**x;
|
||||
let args = &mut [target.as_mut()];
|
||||
self.exec_native_fn_call(
|
||||
global, caches, lib, getter, None, *hash_get, args, is_ref_mut, *pos,
|
||||
level,
|
||||
global, caches, lib, level, getter, None, *hash_get, args, is_ref_mut,
|
||||
*pos,
|
||||
)
|
||||
.map_or_else(
|
||||
|err| match *err {
|
||||
@@ -340,7 +341,7 @@ impl Engine {
|
||||
ERR::ErrorDotExpr(..) => {
|
||||
let mut prop = name.into();
|
||||
self.call_indexer_get(
|
||||
global, caches, lib, target, &mut prop, level,
|
||||
global, caches, lib, level, target, &mut prop,
|
||||
)
|
||||
.map(|r| (r, false))
|
||||
.map_err(|e| match *e {
|
||||
@@ -363,18 +364,20 @@ impl Engine {
|
||||
let val_target = &mut match x.lhs {
|
||||
Expr::Property(ref p, pos) => {
|
||||
#[cfg(feature = "debugging")]
|
||||
self.run_debugger(scope, global, lib, this_ptr, _node, level)?;
|
||||
self.run_debugger(
|
||||
global, caches, lib, level, scope, this_ptr, _node,
|
||||
)?;
|
||||
|
||||
let index = &mut p.2.clone().into();
|
||||
self.get_indexed_mut(
|
||||
global, caches, lib, target, index, pos, false, true, level,
|
||||
global, caches, lib, level, target, index, pos, false, true,
|
||||
)?
|
||||
}
|
||||
// {xxx:map}.fn_name(arg_expr_list)[expr] | {xxx:map}.fn_name(arg_expr_list).expr
|
||||
Expr::MethodCall(ref x, pos) if !x.is_qualified() => {
|
||||
#[cfg(feature = "debugging")]
|
||||
let reset_debugger = self.run_debugger_with_reset(
|
||||
scope, global, lib, this_ptr, _node, level,
|
||||
global, caches, lib, level, scope, this_ptr, _node,
|
||||
)?;
|
||||
|
||||
let crate::ast::FnCallExpr {
|
||||
@@ -386,8 +389,8 @@ impl Engine {
|
||||
let pos1 = args.get(0).map_or(Position::NONE, Expr::position);
|
||||
|
||||
let result = self.make_method_call(
|
||||
global, caches, lib, name, *hashes, target, call_args, pos1,
|
||||
pos, level,
|
||||
global, caches, lib, level, name, *hashes, target, call_args,
|
||||
pos1, pos,
|
||||
);
|
||||
|
||||
idx_values.truncate(offset);
|
||||
@@ -407,8 +410,8 @@ impl Engine {
|
||||
let rhs_chain = rhs.into();
|
||||
|
||||
self.eval_dot_index_chain_helper(
|
||||
global, caches, lib, this_ptr, val_target, root, rhs, *options, &x.rhs,
|
||||
idx_values, rhs_chain, level, new_val,
|
||||
global, caches, lib, level, this_ptr, val_target, root, rhs, *options,
|
||||
&x.rhs, idx_values, rhs_chain, new_val,
|
||||
)
|
||||
.map_err(|err| err.fill_position(*x_pos))
|
||||
}
|
||||
@@ -420,7 +423,9 @@ impl Engine {
|
||||
// xxx.prop[expr] | xxx.prop.expr
|
||||
Expr::Property(ref p, pos) => {
|
||||
#[cfg(feature = "debugging")]
|
||||
self.run_debugger(scope, global, lib, this_ptr, _node, level)?;
|
||||
self.run_debugger(
|
||||
global, caches, lib, level, scope, this_ptr, _node,
|
||||
)?;
|
||||
|
||||
let ((getter, hash_get), (setter, hash_set), name) = &**p;
|
||||
let rhs_chain = rhs.into();
|
||||
@@ -430,15 +435,15 @@ impl Engine {
|
||||
// Assume getters are always pure
|
||||
let (mut val, ..) = self
|
||||
.exec_native_fn_call(
|
||||
global, caches, lib, getter, None, *hash_get, args,
|
||||
is_ref_mut, pos, level,
|
||||
global, caches, lib, level, getter, None, *hash_get, args,
|
||||
is_ref_mut, pos,
|
||||
)
|
||||
.or_else(|err| match *err {
|
||||
// Try an indexer if property does not exist
|
||||
ERR::ErrorDotExpr(..) => {
|
||||
let mut prop = name.into();
|
||||
self.call_indexer_get(
|
||||
global, caches, lib, target, &mut prop, level,
|
||||
global, caches, lib, level, target, &mut prop,
|
||||
)
|
||||
.map(|r| (r, false))
|
||||
.map_err(
|
||||
@@ -455,8 +460,8 @@ impl Engine {
|
||||
|
||||
let (result, may_be_changed) = self
|
||||
.eval_dot_index_chain_helper(
|
||||
global, caches, lib, this_ptr, val, root, rhs, *options,
|
||||
&x.rhs, idx_values, rhs_chain, level, new_val,
|
||||
global, caches, lib, level, this_ptr, val, root, rhs,
|
||||
*options, &x.rhs, idx_values, rhs_chain, new_val,
|
||||
)
|
||||
.map_err(|err| err.fill_position(*x_pos))?;
|
||||
|
||||
@@ -466,8 +471,8 @@ impl Engine {
|
||||
let mut arg_values = [target.as_mut(), val.as_mut()];
|
||||
let args = &mut arg_values;
|
||||
self.exec_native_fn_call(
|
||||
global, caches, lib, setter, None, *hash_set, args,
|
||||
is_ref_mut, pos, level,
|
||||
global, caches, lib, level, setter, None, *hash_set, args,
|
||||
is_ref_mut, pos,
|
||||
)
|
||||
.or_else(
|
||||
|err| match *err {
|
||||
@@ -476,8 +481,8 @@ impl Engine {
|
||||
let idx = &mut name.into();
|
||||
let new_val = val;
|
||||
self.call_indexer_set(
|
||||
global, caches, lib, target, idx, new_val,
|
||||
is_ref_mut, level,
|
||||
global, caches, lib, level, target, idx,
|
||||
new_val, is_ref_mut,
|
||||
)
|
||||
.or_else(|e| match *e {
|
||||
// If there is no setter, no need to feed it
|
||||
@@ -499,7 +504,7 @@ impl Engine {
|
||||
Expr::MethodCall(ref f, pos) if !f.is_qualified() => {
|
||||
#[cfg(feature = "debugging")]
|
||||
let reset_debugger = self.run_debugger_with_reset(
|
||||
scope, global, lib, this_ptr, _node, level,
|
||||
global, caches, lib, level, scope, this_ptr, _node,
|
||||
)?;
|
||||
|
||||
let crate::ast::FnCallExpr {
|
||||
@@ -512,8 +517,8 @@ impl Engine {
|
||||
let pos1 = args.get(0).map_or(Position::NONE, Expr::position);
|
||||
|
||||
let result = self.make_method_call(
|
||||
global, caches, lib, name, *hashes, target, call_args, pos1,
|
||||
pos, level,
|
||||
global, caches, lib, level, name, *hashes, target, call_args,
|
||||
pos1, pos,
|
||||
);
|
||||
|
||||
idx_values.truncate(offset);
|
||||
@@ -525,8 +530,8 @@ impl Engine {
|
||||
let val = &mut val.into();
|
||||
|
||||
self.eval_dot_index_chain_helper(
|
||||
global, caches, lib, this_ptr, val, root, rhs, *options,
|
||||
&x.rhs, idx_values, rhs_chain, level, new_val,
|
||||
global, caches, lib, level, this_ptr, val, root, rhs, *options,
|
||||
&x.rhs, idx_values, rhs_chain, new_val,
|
||||
)
|
||||
.map_err(|err| err.fill_position(pos))
|
||||
}
|
||||
@@ -548,13 +553,13 @@ impl Engine {
|
||||
/// Evaluate a dot/index chain.
|
||||
pub(crate) fn eval_dot_index_chain(
|
||||
&self,
|
||||
scope: &mut Scope,
|
||||
global: &mut GlobalRuntimeState,
|
||||
caches: &mut Caches,
|
||||
lib: &[&Module],
|
||||
level: usize,
|
||||
scope: &mut Scope,
|
||||
this_ptr: &mut Option<&mut Dynamic>,
|
||||
expr: &Expr,
|
||||
level: usize,
|
||||
new_val: &mut Option<(Dynamic, &OpAssignment)>,
|
||||
) -> RhaiResult {
|
||||
let chain_type = ChainType::from(expr);
|
||||
@@ -592,8 +597,8 @@ impl Engine {
|
||||
// All other patterns - evaluate the arguments chain
|
||||
_ => {
|
||||
self.eval_dot_index_chain_arguments(
|
||||
scope, global, caches, lib, this_ptr, rhs, options, chain_type, idx_values,
|
||||
level,
|
||||
global, caches, lib, level, scope, this_ptr, rhs, options, chain_type,
|
||||
idx_values,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
@@ -602,18 +607,18 @@ impl Engine {
|
||||
// id.??? or id[???]
|
||||
Expr::Variable(x, .., var_pos) => {
|
||||
#[cfg(feature = "debugging")]
|
||||
self.run_debugger(scope, global, lib, this_ptr, lhs, level)?;
|
||||
self.run_debugger(global, caches, lib, level, scope, this_ptr, lhs)?;
|
||||
self.track_operation(global, *var_pos)?;
|
||||
|
||||
let (mut target, ..) =
|
||||
self.search_namespace(scope, global, lib, this_ptr, lhs, level)?;
|
||||
self.search_namespace(global, caches, lib, level, scope, this_ptr, lhs)?;
|
||||
|
||||
let obj_ptr = &mut target;
|
||||
let root = (x.3.as_str(), *var_pos);
|
||||
|
||||
self.eval_dot_index_chain_helper(
|
||||
global, caches, lib, &mut None, obj_ptr, root, expr, options, rhs, idx_values,
|
||||
chain_type, level, new_val,
|
||||
global, caches, lib, level, &mut None, obj_ptr, root, expr, options, rhs,
|
||||
idx_values, chain_type, new_val,
|
||||
)
|
||||
}
|
||||
// {expr}.??? = ??? or {expr}[???] = ???
|
||||
@@ -621,14 +626,14 @@ impl Engine {
|
||||
// {expr}.??? or {expr}[???]
|
||||
expr => {
|
||||
let value = self
|
||||
.eval_expr(scope, global, caches, lib, this_ptr, expr, level)?
|
||||
.eval_expr(global, caches, lib, level, scope, this_ptr, expr)?
|
||||
.flatten();
|
||||
let obj_ptr = &mut value.into();
|
||||
let root = ("", expr.start_position());
|
||||
|
||||
self.eval_dot_index_chain_helper(
|
||||
global, caches, lib, this_ptr, obj_ptr, root, expr, options, rhs, idx_values,
|
||||
chain_type, level, new_val,
|
||||
global, caches, lib, level, this_ptr, obj_ptr, root, expr, options, rhs,
|
||||
idx_values, chain_type, new_val,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -639,16 +644,16 @@ impl Engine {
|
||||
/// Evaluate a chain of indexes and store the results in a [`FnArgsVec`].
|
||||
fn eval_dot_index_chain_arguments(
|
||||
&self,
|
||||
scope: &mut Scope,
|
||||
global: &mut GlobalRuntimeState,
|
||||
caches: &mut Caches,
|
||||
lib: &[&Module],
|
||||
level: usize,
|
||||
scope: &mut Scope,
|
||||
this_ptr: &mut Option<&mut Dynamic>,
|
||||
expr: &Expr,
|
||||
parent_options: ASTFlags,
|
||||
parent_chain_type: ChainType,
|
||||
idx_values: &mut FnArgsVec<Dynamic>,
|
||||
level: usize,
|
||||
) -> RhaiResultOf<()> {
|
||||
self.track_operation(global, expr.position())?;
|
||||
|
||||
@@ -659,7 +664,7 @@ impl Engine {
|
||||
{
|
||||
for arg_expr in &x.args {
|
||||
idx_values.push(
|
||||
self.get_arg_value(scope, global, caches, lib, this_ptr, arg_expr, level)?
|
||||
self.get_arg_value(global, caches, lib, level, scope, this_ptr, arg_expr)?
|
||||
.0
|
||||
.flatten(),
|
||||
);
|
||||
@@ -694,7 +699,7 @@ impl Engine {
|
||||
for arg_expr in &x.args {
|
||||
_arg_values.push(
|
||||
self.get_arg_value(
|
||||
scope, global, caches, lib, this_ptr, arg_expr, level,
|
||||
global, caches, lib, level, scope, this_ptr, arg_expr,
|
||||
)?
|
||||
.0
|
||||
.flatten(),
|
||||
@@ -712,7 +717,7 @@ impl Engine {
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
_ if parent_chain_type == ChainType::Indexing => {
|
||||
_arg_values.push(
|
||||
self.eval_expr(scope, global, caches, lib, this_ptr, lhs, level)?
|
||||
self.eval_expr(global, caches, lib, level, scope, this_ptr, lhs)?
|
||||
.flatten(),
|
||||
);
|
||||
}
|
||||
@@ -723,8 +728,8 @@ impl Engine {
|
||||
let chain_type = expr.into();
|
||||
|
||||
self.eval_dot_index_chain_arguments(
|
||||
scope, global, caches, lib, this_ptr, rhs, *options, chain_type, idx_values,
|
||||
level,
|
||||
global, caches, lib, level, scope, this_ptr, rhs, *options, chain_type,
|
||||
idx_values,
|
||||
)?;
|
||||
|
||||
if !_arg_values.is_empty() {
|
||||
@@ -738,7 +743,7 @@ impl Engine {
|
||||
}
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
_ if parent_chain_type == ChainType::Indexing => idx_values.push(
|
||||
self.eval_expr(scope, global, caches, lib, this_ptr, expr, level)?
|
||||
self.eval_expr(global, caches, lib, level, scope, this_ptr, expr)?
|
||||
.flatten(),
|
||||
),
|
||||
_ => unreachable!("unknown chained expression: {:?}", expr),
|
||||
@@ -754,9 +759,9 @@ impl Engine {
|
||||
global: &mut GlobalRuntimeState,
|
||||
caches: &mut Caches,
|
||||
lib: &[&Module],
|
||||
level: usize,
|
||||
target: &mut Dynamic,
|
||||
idx: &mut Dynamic,
|
||||
level: usize,
|
||||
) -> RhaiResultOf<Dynamic> {
|
||||
let args = &mut [target, idx];
|
||||
let hash = global.hash_idx_get();
|
||||
@@ -765,7 +770,7 @@ impl Engine {
|
||||
let level = level + 1;
|
||||
|
||||
self.exec_native_fn_call(
|
||||
global, caches, lib, fn_name, None, hash, args, true, pos, level,
|
||||
global, caches, lib, level, fn_name, None, hash, args, true, pos,
|
||||
)
|
||||
.map(|(r, ..)| r)
|
||||
}
|
||||
@@ -777,11 +782,11 @@ impl Engine {
|
||||
global: &mut GlobalRuntimeState,
|
||||
caches: &mut Caches,
|
||||
lib: &[&Module],
|
||||
level: usize,
|
||||
target: &mut Dynamic,
|
||||
idx: &mut Dynamic,
|
||||
new_val: &mut Dynamic,
|
||||
is_ref_mut: bool,
|
||||
level: usize,
|
||||
) -> RhaiResultOf<(Dynamic, bool)> {
|
||||
let hash = global.hash_idx_set();
|
||||
let args = &mut [target, idx, new_val];
|
||||
@@ -790,7 +795,7 @@ impl Engine {
|
||||
let level = level + 1;
|
||||
|
||||
self.exec_native_fn_call(
|
||||
global, caches, lib, fn_name, None, hash, args, is_ref_mut, pos, level,
|
||||
global, caches, lib, level, fn_name, None, hash, args, is_ref_mut, pos,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -801,12 +806,12 @@ impl Engine {
|
||||
global: &mut GlobalRuntimeState,
|
||||
caches: &mut Caches,
|
||||
lib: &[&Module],
|
||||
level: usize,
|
||||
target: &'t mut Dynamic,
|
||||
idx: &mut Dynamic,
|
||||
idx_pos: Position,
|
||||
_add_if_not_found: bool,
|
||||
use_indexers: bool,
|
||||
level: usize,
|
||||
) -> RhaiResultOf<Target<'t>> {
|
||||
self.track_operation(global, Position::NONE)?;
|
||||
|
||||
@@ -1010,7 +1015,7 @@ impl Engine {
|
||||
}
|
||||
|
||||
_ if use_indexers => self
|
||||
.call_indexer_get(global, caches, lib, target, idx, level)
|
||||
.call_indexer_get(global, caches, lib, level, target, idx)
|
||||
.map(Into::into),
|
||||
|
||||
_ => Err(ERR::ErrorIndexingType(
|
||||
|
Reference in New Issue
Block a user