optimized OP_INVOKE, embedded the identifier in the instruction

This commit is contained in:
2021-01-07 20:02:19 -06:00
parent 1351ff63b1
commit c5ee704317
3 changed files with 12 additions and 8 deletions

View File

@@ -667,12 +667,11 @@ static void dot(CParseState *pstate, bool canAssign, Precedence prec) {
writeu8(pstate, 128 - 1);
writeu16(pstate, name);
} else if (match(pstate, TOKEN_LEFT_PAREN)) { // it's an invoked call
writeu8(pstate, OP_LOADCONST);
writeu16(pstate, name);
uint8_t args = parseArguments(pstate);
writeu8(pstate, OP_INVOKE);
writeu8(pstate, args);
writeu8(pstate, pstate->compiler->expectedValues);
writeu16(pstate, name);
valuePopped(pstate, args+1); // args + function
valuePushed(pstate, pstate->compiler->expectedValues);
} else {