MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / codenot

Function codenot

extlibs/lua/src/lcode.c:1169–1197  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1167** Code 'not e', doing constant folding.
1168*/
1169static void codenot (FuncState *fs, expdesc *e) {
1170 switch (e->k) {
1171 case VNIL: case VFALSE: {
1172 e->k = VTRUE; /* true == not nil == not false */
1173 break;
1174 }
1175 case VK: case VKFLT: case VKINT: case VKSTR: case VTRUE: {
1176 e->k = VFALSE; /* false == not "x" == not 0.5 == not 1 == not true */
1177 break;
1178 }
1179 case VJMP: {
1180 negatecondition(fs, e);
1181 break;
1182 }
1183 case VRELOC:
1184 case VNONRELOC: {
1185 discharge2anyreg(fs, e);
1186 freeexp(fs, e);
1187 e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0);
1188 e->k = VRELOC;
1189 break;
1190 }
1191 default: lua_assert(0); /* cannot happen */
1192 }
1193 /* interchange true and false lists */
1194 { int temp = e->f; e->f = e->t; e->t = temp; }
1195 removevalues(fs, e->f); /* values are useless when negated */
1196 removevalues(fs, e->t);
1197}
1198
1199
1200/*

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