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

Function codenot

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

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

Source from the content-addressed store, hash-verified

1186** Code 'not e', doing constant folding.
1187*/
1188static void codenot (FuncState *fs, expdesc *e) {
1189 switch (e->k) {
1190 case VNIL: case VFALSE: {
1191 e->k = VTRUE; /* true == not nil == not false */
1192 break;
1193 }
1194 case VK: case VKFLT: case VKINT: case VKSTR: case VTRUE: {
1195 e->k = VFALSE; /* false == not "x" == not 0.5 == not 1 == not true */
1196 break;
1197 }
1198 case VJMP: {
1199 negatecondition(fs, e);
1200 break;
1201 }
1202 case VRELOC:
1203 case VNONRELOC: {
1204 discharge2anyreg(fs, e);
1205 freeexp(fs, e);
1206 e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0);
1207 e->k = VRELOC;
1208 break;
1209 }
1210 default: lua_assert(0); /* cannot happen */
1211 }
1212 /* interchange true and false lists */
1213 { int temp = e->f; e->f = e->t; e->t = temp; }
1214 removevalues(fs, e->f); /* values are useless when negated */
1215 removevalues(fs, e->t);
1216}
1217
1218
1219/*

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