Skip to content

Commit 09dbfd2

Browse files
committed
libscript: Spanify MCScriptBytecodeOp_InvokeIndirect::Execute()
1 parent 18d204f commit 09dbfd2

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

libscript/src/script-bytecode.hpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,7 @@ struct MCScriptBytecodeOp_InvokeIndirect
466466
t_result_reg = ctxt.GetArgument(1);
467467

468468
// The argument list starts at the third argument.
469-
const uindex_t *t_argument_regs;
470-
uindex_t t_argument_count;
471-
t_argument_regs = ctxt.GetArgumentList() + 2;
472-
t_argument_count = ctxt.GetArgumentCount() - 2;
469+
MCSpan<const uindex_t> t_argument_regs(ctxt.GetArguments().subspan(2));
473470

474471
MCValueRef t_handler;
475472
t_handler = ctxt.CheckedFetchRegister(ctxt.GetArgument(0));
@@ -484,8 +481,8 @@ struct MCScriptBytecodeOp_InvokeIndirect
484481

485482
#ifdef DEBUG_EXECUTION
486483
MCLog("Invoke handler value %p from register %u into %u", t_handler, t_result_reg);
487-
for(uindex_t i = 0; i < t_argument_count; i++)
488-
MCLog(" argument register %u", t_argument_regs[i]);
484+
for(MCSpan<const uindex_t> t_rest = t_argument_regs; !t_rest.empty(); ++t_rest)
485+
MCLog(" argument register %u", *t_rest);
489486
#endif
490487

491488
// If the handler-ref is of 'internal' kind (i.e. a instance/definition
@@ -497,14 +494,14 @@ struct MCScriptBytecodeOp_InvokeIndirect
497494
InternalInvoke(ctxt,
498495
(MCHandlerRef)t_handler,
499496
t_result_reg,
500-
MCMakeSpan(t_argument_regs, t_argument_count));
497+
t_argument_regs);
501498
}
502499
else
503500
{
504501
ExternalInvoke(ctxt,
505502
(MCHandlerRef)t_handler,
506503
t_result_reg,
507-
MCMakeSpan(t_argument_regs, t_argument_count));
504+
t_argument_regs);
508505
}
509506
}
510507

0 commit comments

Comments
 (0)