MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / finishbinexpneg

Function finishbinexpneg

third-party/lua-5.4.6/src/lcode.c:1464–1480  ·  view source on GitHub ↗

Try to code a binary operator negating its second operand. ** For the metamethod, 2nd operand must keep its original value. */

Source from the content-addressed store, hash-verified

1462** For the metamethod, 2nd operand must keep its original value.
1463*/
1464static int finishbinexpneg (FuncState *fs, expdesc *e1, expdesc *e2,
1465 OpCode op, int line, TMS event) {
1466 if (!isKint(e2))
1467 return 0; /* not an integer constant */
1468 else {
1469 lua_Integer i2 = e2->u.ival;
1470 if (!(fitsC(i2) && fitsC(-i2)))
1471 return 0; /* not in the proper range */
1472 else { /* operating a small integer constant */
1473 int v2 = cast_int(i2);
1474 finishbinexpval(fs, e1, e2, op, int2sC(-v2), 0, line, OP_MMBINI, event);
1475 /* correct metamethod argument */
1476 SETARG_B(fs->f->code[fs->pc - 1], int2sC(v2));
1477 return 1; /* successfully coded */
1478 }
1479 }
1480}
1481
1482
1483static void swapexps (expdesc *e1, expdesc *e2) {

Callers 1

luaK_posfixFunction · 0.70

Calls 3

isKintFunction · 0.70
fitsCFunction · 0.70
finishbinexpvalFunction · 0.70

Tested by

no test coverage detected