MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / codenot

Function codenot

lib/lua/src/lcode.c:1187–1215  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 1

luaK_prefixFunction · 0.85

Calls 4

negateconditionFunction · 0.85
discharge2anyregFunction · 0.85
freeexpFunction · 0.85
removevaluesFunction · 0.85

Tested by

no test coverage detected