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

Function codenot

third-party/lua-5.5.0/src/lcode.c:1231–1259  ·  view source on GitHub ↗

** Code 'not e', doing constant folding. */

Source from the content-addressed store, hash-verified

1229** Code 'not e', doing constant folding.
1230*/
1231static void codenot (FuncState *fs, expdesc *e) {
1232 switch (e->k) {
1233 case VNIL: case VFALSE: {
1234 e->k = VTRUE; /* true == not nil == not false */
1235 break;
1236 }
1237 case VK: case VKFLT: case VKINT: case VKSTR: case VTRUE: {
1238 e->k = VFALSE; /* false == not "x" == not 0.5 == not 1 == not true */
1239 break;
1240 }
1241 case VJMP: {
1242 negatecondition(fs, e);
1243 break;
1244 }
1245 case VRELOC:
1246 case VNONRELOC: {
1247 discharge2anyreg(fs, e);
1248 freeexp(fs, e);
1249 e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0);
1250 e->k = VRELOC;
1251 break;
1252 }
1253 default: lua_assert(0); /* cannot happen */
1254 }
1255 /* interchange true and false lists */
1256 { int temp = e->f; e->f = e->t; e->t = temp; }
1257 removevalues(fs, e->f); /* values are useless when negated */
1258 removevalues(fs, e->t);
1259}
1260
1261
1262/*

Callers 1

luaK_prefixFunction · 0.70

Calls 5

negateconditionFunction · 0.70
discharge2anyregFunction · 0.70
freeexpFunction · 0.70
removevaluesFunction · 0.70
luaK_codeABCFunction · 0.50

Tested by

no test coverage detected