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

Function finishbinexpneg

third-party/lua-5.5.0/src/lcode.c:1545–1561  ·  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

1543** For the metamethod, 2nd operand must keep its original value.
1544*/
1545static int finishbinexpneg (FuncState *fs, expdesc *e1, expdesc *e2,
1546 OpCode op, int line, TMS event) {
1547 if (!isKint(e2))
1548 return 0; /* not an integer constant */
1549 else {
1550 lua_Integer i2 = e2->u.ival;
1551 if (!(fitsC(i2) && fitsC(-i2)))
1552 return 0; /* not in the proper range */
1553 else { /* operating a small integer constant */
1554 int v2 = cast_int(i2);
1555 finishbinexpval(fs, e1, e2, op, int2sC(-v2), 0, line, OP_MMBINI, event);
1556 /* correct metamethod argument */
1557 SETARG_B(fs->f->code[fs->pc - 1], int2sC(v2));
1558 return 1; /* successfully coded */
1559 }
1560 }
1561}
1562
1563
1564static 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