diff options
-rw-r--r-- | lapi.c | 5 | ||||
-rw-r--r-- | lcode.c | 50 | ||||
-rw-r--r-- | ldebug.c | 2 | ||||
-rw-r--r-- | ldump.c | 5 | ||||
-rw-r--r-- | ljumptab.h | 3 | ||||
-rw-r--r-- | llex.c | 2 | ||||
-rw-r--r-- | lobject.h | 17 | ||||
-rw-r--r-- | lopcodes.c | 3 | ||||
-rw-r--r-- | lopcodes.h | 3 | ||||
-rw-r--r-- | lopnames.h | 3 | ||||
-rw-r--r-- | ltable.c | 10 | ||||
-rw-r--r-- | lundump.c | 7 | ||||
-rw-r--r-- | lvm.c | 19 | ||||
-rw-r--r-- | testes/code.lua | 10 |
14 files changed, 87 insertions, 52 deletions
@@ -574,7 +574,10 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { | |||
574 | 574 | ||
575 | LUA_API void lua_pushboolean (lua_State *L, int b) { | 575 | LUA_API void lua_pushboolean (lua_State *L, int b) { |
576 | lua_lock(L); | 576 | lua_lock(L); |
577 | setbvalue(s2v(L->top), (b != 0)); /* ensure that true is 1 */ | 577 | if (b) |
578 | setbtvalue(s2v(L->top)); | ||
579 | else | ||
580 | setbfvalue(s2v(L->top)); | ||
578 | api_incr_top(L); | 581 | api_incr_top(L); |
579 | lua_unlock(L); | 582 | lua_unlock(L); |
580 | } | 583 | } |
@@ -84,8 +84,11 @@ int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v) { | |||
84 | if (hasjumps(e)) | 84 | if (hasjumps(e)) |
85 | return 0; /* not a constant */ | 85 | return 0; /* not a constant */ |
86 | switch (e->k) { | 86 | switch (e->k) { |
87 | case VFALSE: case VTRUE: | 87 | case VFALSE: |
88 | setbvalue(v, e->k == VTRUE); | 88 | setbfvalue(v); |
89 | return 1; | ||
90 | case VTRUE: | ||
91 | setbtvalue(v); | ||
89 | return 1; | 92 | return 1; |
90 | case VNIL: | 93 | case VNIL: |
91 | setnilvalue(v); | 94 | setnilvalue(v); |
@@ -604,11 +607,21 @@ static int luaK_numberK (FuncState *fs, lua_Number r) { | |||
604 | 607 | ||
605 | 608 | ||
606 | /* | 609 | /* |
607 | ** Add a boolean to list of constants and return its index. | 610 | ** Add a false to list of constants and return its index. |
608 | */ | 611 | */ |
609 | static int boolK (FuncState *fs, int b) { | 612 | static int boolF (FuncState *fs) { |
610 | TValue o; | 613 | TValue o; |
611 | setbvalue(&o, b); | 614 | setbfvalue(&o); |
615 | return addk(fs, &o, &o); /* use boolean itself as key */ | ||
616 | } | ||
617 | |||
618 | |||
619 | /* | ||
620 | ** Add a true to list of constants and return its index. | ||
621 | */ | ||
622 | static int boolT (FuncState *fs) { | ||
623 | TValue o; | ||
624 | setbtvalue(&o); | ||
612 | return addk(fs, &o, &o); /* use boolean itself as key */ | 625 | return addk(fs, &o, &o); /* use boolean itself as key */ |
613 | } | 626 | } |
614 | 627 | ||
@@ -671,8 +684,11 @@ static void const2exp (TValue *v, expdesc *e) { | |||
671 | case LUA_TNUMFLT: | 684 | case LUA_TNUMFLT: |
672 | e->k = VKFLT; e->u.nval = fltvalue(v); | 685 | e->k = VKFLT; e->u.nval = fltvalue(v); |
673 | break; | 686 | break; |
674 | case LUA_TBOOLEAN: | 687 | case LUA_TFALSE: |
675 | e->k = bvalue(v) ? VTRUE : VFALSE; | 688 | e->k = VFALSE; |
689 | break; | ||
690 | case LUA_TTRUE: | ||
691 | e->k = VTRUE; | ||
676 | break; | 692 | break; |
677 | case LUA_TNIL: | 693 | case LUA_TNIL: |
678 | e->k = VNIL; | 694 | e->k = VNIL; |
@@ -801,8 +817,12 @@ static void discharge2reg (FuncState *fs, expdesc *e, int reg) { | |||
801 | luaK_nil(fs, reg, 1); | 817 | luaK_nil(fs, reg, 1); |
802 | break; | 818 | break; |
803 | } | 819 | } |
804 | case VFALSE: case VTRUE: { | 820 | case VFALSE: { |
805 | luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); | 821 | luaK_codeABC(fs, OP_LOADFALSE, reg, 0, 0); |
822 | break; | ||
823 | } | ||
824 | case VTRUE: { | ||
825 | luaK_codeABC(fs, OP_LOADTRUE, reg, 0, 0); | ||
806 | break; | 826 | break; |
807 | } | 827 | } |
808 | case VKSTR: { | 828 | case VKSTR: { |
@@ -852,9 +872,9 @@ static void discharge2anyreg (FuncState *fs, expdesc *e) { | |||
852 | } | 872 | } |
853 | 873 | ||
854 | 874 | ||
855 | static int code_loadbool (FuncState *fs, int A, int b, int jump) { | 875 | static int code_loadbool (FuncState *fs, int A, OpCode op, int jump) { |
856 | luaK_getlabel(fs); /* those instructions may be jump targets */ | 876 | luaK_getlabel(fs); /* those instructions may be jump targets */ |
857 | return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); | 877 | return luaK_codeABC(fs, op, A, jump, 0); |
858 | } | 878 | } |
859 | 879 | ||
860 | 880 | ||
@@ -888,8 +908,8 @@ static void exp2reg (FuncState *fs, expdesc *e, int reg) { | |||
888 | int p_t = NO_JUMP; /* position of an eventual LOAD true */ | 908 | int p_t = NO_JUMP; /* position of an eventual LOAD true */ |
889 | if (need_value(fs, e->t) || need_value(fs, e->f)) { | 909 | if (need_value(fs, e->t) || need_value(fs, e->f)) { |
890 | int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); | 910 | int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); |
891 | p_f = code_loadbool(fs, reg, 0, 1); /* load false and skip next i. */ | 911 | p_f = code_loadbool(fs, reg, OP_LOADFALSE, 1); /* skip next inst. */ |
892 | p_t = code_loadbool(fs, reg, 1, 0); /* load true */ | 912 | p_t = code_loadbool(fs, reg, OP_LOADTRUE, 0); |
893 | /* jump around these booleans if 'e' is not a test */ | 913 | /* jump around these booleans if 'e' is not a test */ |
894 | luaK_patchtohere(fs, fj); | 914 | luaK_patchtohere(fs, fj); |
895 | } | 915 | } |
@@ -963,8 +983,8 @@ static int luaK_exp2K (FuncState *fs, expdesc *e) { | |||
963 | if (!hasjumps(e)) { | 983 | if (!hasjumps(e)) { |
964 | int info; | 984 | int info; |
965 | switch (e->k) { /* move constants to 'k' */ | 985 | switch (e->k) { /* move constants to 'k' */ |
966 | case VTRUE: info = boolK(fs, 1); break; | 986 | case VTRUE: info = boolT(fs); break; |
967 | case VFALSE: info = boolK(fs, 0); break; | 987 | case VFALSE: info = boolF(fs); break; |
968 | case VNIL: info = nilK(fs); break; | 988 | case VNIL: info = nilK(fs); break; |
969 | case VKINT: info = luaK_intK(fs, e->u.ival); break; | 989 | case VKINT: info = luaK_intK(fs, e->u.ival); break; |
970 | case VKFLT: info = luaK_numberK(fs, e->u.nval); break; | 990 | case VKFLT: info = luaK_numberK(fs, e->u.nval); break; |
@@ -306,7 +306,7 @@ static void collectvalidlines (lua_State *L, Closure *f) { | |||
306 | Table *t = luaH_new(L); /* new table to store active lines */ | 306 | Table *t = luaH_new(L); /* new table to store active lines */ |
307 | sethvalue2s(L, L->top, t); /* push it on stack */ | 307 | sethvalue2s(L, L->top, t); /* push it on stack */ |
308 | api_incr_top(L); | 308 | api_incr_top(L); |
309 | setbvalue(&v, 1); /* boolean 'true' to be the value of all indices */ | 309 | setbtvalue(&v); /* boolean 'true' to be the value of all indices */ |
310 | for (i = 0; i < p->sizelineinfo; i++) { /* for all lines with code */ | 310 | for (i = 0; i < p->sizelineinfo; i++) { /* for all lines with code */ |
311 | currentline = nextline(p, currentline, i); | 311 | currentline = nextline(p, currentline, i); |
312 | luaH_setint(L, t, currentline, &v); /* table[line] = true */ | 312 | luaH_setint(L, t, currentline, &v); /* table[line] = true */ |
@@ -113,10 +113,7 @@ static void DumpConstants (const Proto *f, DumpState *D) { | |||
113 | const TValue *o = &f->k[i]; | 113 | const TValue *o = &f->k[i]; |
114 | DumpByte(ttypetag(o), D); | 114 | DumpByte(ttypetag(o), D); |
115 | switch (ttypetag(o)) { | 115 | switch (ttypetag(o)) { |
116 | case LUA_TNIL: | 116 | case LUA_TNIL: case LUA_TFALSE: case LUA_TTRUE: |
117 | break; | ||
118 | case LUA_TBOOLEAN: | ||
119 | DumpByte(bvalue(o), D); | ||
120 | break; | 117 | break; |
121 | case LUA_TNUMFLT: | 118 | case LUA_TNUMFLT: |
122 | DumpNumber(fltvalue(o), D); | 119 | DumpNumber(fltvalue(o), D); |
@@ -30,7 +30,8 @@ static void *disptab[NUM_OPCODES] = { | |||
30 | &&L_OP_LOADF, | 30 | &&L_OP_LOADF, |
31 | &&L_OP_LOADK, | 31 | &&L_OP_LOADK, |
32 | &&L_OP_LOADKX, | 32 | &&L_OP_LOADKX, |
33 | &&L_OP_LOADBOOL, | 33 | &&L_OP_LOADFALSE, |
34 | &&L_OP_LOADTRUE, | ||
34 | &&L_OP_LOADNIL, | 35 | &&L_OP_LOADNIL, |
35 | &&L_OP_GETUPVAL, | 36 | &&L_OP_GETUPVAL, |
36 | &&L_OP_SETUPVAL, | 37 | &&L_OP_SETUPVAL, |
@@ -136,7 +136,7 @@ TString *luaX_newstring (LexState *ls, const char *str, size_t l) { | |||
136 | if (isempty(o)) { /* not in use yet? */ | 136 | if (isempty(o)) { /* not in use yet? */ |
137 | /* boolean value does not need GC barrier; | 137 | /* boolean value does not need GC barrier; |
138 | table is not a metatable, so it does not need to invalidate cache */ | 138 | table is not a metatable, so it does not need to invalidate cache */ |
139 | setbvalue(o, 1); /* t[string] = true */ | 139 | setbtvalue(o); /* t[string] = true */ |
140 | luaC_checkGC(L); | 140 | luaC_checkGC(L); |
141 | } | 141 | } |
142 | else { /* string already present */ | 142 | else { /* string already present */ |
@@ -44,7 +44,6 @@ | |||
44 | typedef union Value { | 44 | typedef union Value { |
45 | struct GCObject *gc; /* collectable objects */ | 45 | struct GCObject *gc; /* collectable objects */ |
46 | void *p; /* light userdata */ | 46 | void *p; /* light userdata */ |
47 | int b; /* booleans */ | ||
48 | lua_CFunction f; /* light C functions */ | 47 | lua_CFunction f; /* light C functions */ |
49 | lua_Integer i; /* integer numbers */ | 48 | lua_Integer i; /* integer numbers */ |
50 | lua_Number n; /* float numbers */ | 49 | lua_Number n; /* float numbers */ |
@@ -210,16 +209,20 @@ typedef StackValue *StkId; | |||
210 | ** =================================================================== | 209 | ** =================================================================== |
211 | */ | 210 | */ |
212 | 211 | ||
213 | #define ttisboolean(o) checktag((o), LUA_TBOOLEAN) | ||
214 | 212 | ||
215 | #define bvalue(o) check_exp(ttisboolean(o), val_(o).b) | 213 | #define LUA_TFALSE (LUA_TBOOLEAN | (1 << 4)) |
214 | #define LUA_TTRUE (LUA_TBOOLEAN | (2 << 4)) | ||
216 | 215 | ||
217 | #define bvalueraw(v) ((v).b) | 216 | #define ttisboolean(o) checktype((o), LUA_TBOOLEAN) |
217 | #define ttisfalse(o) checktag((o), LUA_TFALSE) | ||
218 | #define ttistrue(o) checktag((o), LUA_TTRUE) | ||
218 | 219 | ||
219 | #define l_isfalse(o) (ttisboolean(o) ? bvalue(o) == 0 : ttisnil(o)) | ||
220 | 220 | ||
221 | #define setbvalue(obj,x) \ | 221 | #define l_isfalse(o) (ttisfalse(o) || ttisnil(o)) |
222 | { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); } | 222 | |
223 | |||
224 | #define setbfvalue(obj) settt_(obj, LUA_TFALSE) | ||
225 | #define setbtvalue(obj) settt_(obj, LUA_TTRUE) | ||
223 | 226 | ||
224 | /* }================================================================== */ | 227 | /* }================================================================== */ |
225 | 228 | ||
@@ -24,7 +24,8 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { | |||
24 | ,opmode(0, 0, 0, 0, 1, iAsBx) /* OP_LOADF */ | 24 | ,opmode(0, 0, 0, 0, 1, iAsBx) /* OP_LOADF */ |
25 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_LOADK */ | 25 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_LOADK */ |
26 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_LOADKX */ | 26 | ,opmode(0, 0, 0, 0, 1, iABx) /* OP_LOADKX */ |
27 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADBOOL */ | 27 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADFALSE */ |
28 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADTRUE */ | ||
28 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADNIL */ | 29 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADNIL */ |
29 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETUPVAL */ | 30 | ,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETUPVAL */ |
30 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETUPVAL */ | 31 | ,opmode(0, 0, 0, 0, 0, iABC) /* OP_SETUPVAL */ |
@@ -202,7 +202,8 @@ OP_LOADI,/* A sBx R[A] := sBx */ | |||
202 | OP_LOADF,/* A sBx R[A] := (lua_Number)sBx */ | 202 | OP_LOADF,/* A sBx R[A] := (lua_Number)sBx */ |
203 | OP_LOADK,/* A Bx R[A] := K[Bx] */ | 203 | OP_LOADK,/* A Bx R[A] := K[Bx] */ |
204 | OP_LOADKX,/* A R[A] := K[extra arg] */ | 204 | OP_LOADKX,/* A R[A] := K[extra arg] */ |
205 | OP_LOADBOOL,/* A B C R[A] := (Bool)B; if (C) pc++ */ | 205 | OP_LOADFALSE,/* A B R[A] := false; if (B) pc++ */ |
206 | OP_LOADTRUE,/* A R[A] := true */ | ||
206 | OP_LOADNIL,/* A B R[A], R[A+1], ..., R[A+B] := nil */ | 207 | OP_LOADNIL,/* A B R[A], R[A+1], ..., R[A+B] := nil */ |
207 | OP_GETUPVAL,/* A B R[A] := UpValue[B] */ | 208 | OP_GETUPVAL,/* A B R[A] := UpValue[B] */ |
208 | OP_SETUPVAL,/* A B UpValue[B] := R[A] */ | 209 | OP_SETUPVAL,/* A B UpValue[B] := R[A] */ |
@@ -15,7 +15,8 @@ static const char *const opnames[] = { | |||
15 | "LOADF", | 15 | "LOADF", |
16 | "LOADK", | 16 | "LOADK", |
17 | "LOADKX", | 17 | "LOADKX", |
18 | "LOADBOOL", | 18 | "LOADFALSE", |
19 | "LOADTRUE", | ||
19 | "LOADNIL", | 20 | "LOADNIL", |
20 | "GETUPVAL", | 21 | "GETUPVAL", |
21 | "SETUPVAL", | 22 | "SETUPVAL", |
@@ -143,8 +143,10 @@ static Node *mainposition (const Table *t, int ktt, const Value *kvl) { | |||
143 | return hashstr(t, tsvalueraw(*kvl)); | 143 | return hashstr(t, tsvalueraw(*kvl)); |
144 | case LUA_TLNGSTR: | 144 | case LUA_TLNGSTR: |
145 | return hashpow2(t, luaS_hashlongstr(tsvalueraw(*kvl))); | 145 | return hashpow2(t, luaS_hashlongstr(tsvalueraw(*kvl))); |
146 | case LUA_TBOOLEAN: | 146 | case LUA_TFALSE: |
147 | return hashboolean(t, bvalueraw(*kvl)); | 147 | return hashboolean(t, 0); |
148 | case LUA_TTRUE: | ||
149 | return hashboolean(t, 1); | ||
148 | case LUA_TLIGHTUSERDATA: | 150 | case LUA_TLIGHTUSERDATA: |
149 | return hashpointer(t, pvalueraw(*kvl)); | 151 | return hashpointer(t, pvalueraw(*kvl)); |
150 | case LUA_TLCF: | 152 | case LUA_TLCF: |
@@ -175,14 +177,12 @@ static int equalkey (const TValue *k1, const Node *n2) { | |||
175 | if (rawtt(k1) != keytt(n2)) /* not the same variants? */ | 177 | if (rawtt(k1) != keytt(n2)) /* not the same variants? */ |
176 | return 0; /* cannot be same key */ | 178 | return 0; /* cannot be same key */ |
177 | switch (ttypetag(k1)) { | 179 | switch (ttypetag(k1)) { |
178 | case LUA_TNIL: | 180 | case LUA_TNIL: case LUA_TFALSE: case LUA_TTRUE: |
179 | return 1; | 181 | return 1; |
180 | case LUA_TNUMINT: | 182 | case LUA_TNUMINT: |
181 | return (ivalue(k1) == keyival(n2)); | 183 | return (ivalue(k1) == keyival(n2)); |
182 | case LUA_TNUMFLT: | 184 | case LUA_TNUMFLT: |
183 | return luai_numeq(fltvalue(k1), fltvalueraw(keyval(n2))); | 185 | return luai_numeq(fltvalue(k1), fltvalueraw(keyval(n2))); |
184 | case LUA_TBOOLEAN: | ||
185 | return bvalue(k1) == bvalueraw(keyval(n2)); | ||
186 | case LUA_TLIGHTUSERDATA: | 186 | case LUA_TLIGHTUSERDATA: |
187 | return pvalue(k1) == pvalueraw(keyval(n2)); | 187 | return pvalue(k1) == pvalueraw(keyval(n2)); |
188 | case LUA_TLCF: | 188 | case LUA_TLCF: |
@@ -160,8 +160,11 @@ static void LoadConstants (LoadState *S, Proto *f) { | |||
160 | case LUA_TNIL: | 160 | case LUA_TNIL: |
161 | setnilvalue(o); | 161 | setnilvalue(o); |
162 | break; | 162 | break; |
163 | case LUA_TBOOLEAN: | 163 | case LUA_TFALSE: |
164 | setbvalue(o, LoadByte(S)); | 164 | setbfvalue(o); |
165 | break; | ||
166 | case LUA_TTRUE: | ||
167 | setbtvalue(o); | ||
165 | break; | 168 | break; |
166 | case LUA_TNUMFLT: | 169 | case LUA_TNUMFLT: |
167 | setfltvalue(o, LoadNumber(S)); | 170 | setfltvalue(o, LoadNumber(S)); |
@@ -577,10 +577,9 @@ int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { | |||
577 | } | 577 | } |
578 | /* values have same type and same variant */ | 578 | /* values have same type and same variant */ |
579 | switch (ttypetag(t1)) { | 579 | switch (ttypetag(t1)) { |
580 | case LUA_TNIL: return 1; | 580 | case LUA_TNIL: case LUA_TFALSE: case LUA_TTRUE: return 1; |
581 | case LUA_TNUMINT: return (ivalue(t1) == ivalue(t2)); | 581 | case LUA_TNUMINT: return (ivalue(t1) == ivalue(t2)); |
582 | case LUA_TNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2)); | 582 | case LUA_TNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2)); |
583 | case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1! */ | ||
584 | case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); | 583 | case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); |
585 | case LUA_TLCF: return fvalue(t1) == fvalue(t2); | 584 | case LUA_TLCF: return fvalue(t1) == fvalue(t2); |
586 | case LUA_TSHRSTR: return eqshrstr(tsvalue(t1), tsvalue(t2)); | 585 | case LUA_TSHRSTR: return eqshrstr(tsvalue(t1), tsvalue(t2)); |
@@ -1182,9 +1181,13 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1182 | setobj2s(L, ra, rb); | 1181 | setobj2s(L, ra, rb); |
1183 | vmbreak; | 1182 | vmbreak; |
1184 | } | 1183 | } |
1185 | vmcase(OP_LOADBOOL) { | 1184 | vmcase(OP_LOADFALSE) { |
1186 | setbvalue(s2v(ra), GETARG_B(i)); | 1185 | setbfvalue(s2v(ra)); |
1187 | if (GETARG_C(i)) pc++; /* skip next instruction (if C) */ | 1186 | if (GETARG_B(i)) pc++; /* if B, skip next instruction */ |
1187 | vmbreak; | ||
1188 | } | ||
1189 | vmcase(OP_LOADTRUE) { | ||
1190 | setbtvalue(s2v(ra)); | ||
1188 | vmbreak; | 1191 | vmbreak; |
1189 | } | 1192 | } |
1190 | vmcase(OP_LOADNIL) { | 1193 | vmcase(OP_LOADNIL) { |
@@ -1503,8 +1506,10 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1503 | } | 1506 | } |
1504 | vmcase(OP_NOT) { | 1507 | vmcase(OP_NOT) { |
1505 | TValue *rb = vRB(i); | 1508 | TValue *rb = vRB(i); |
1506 | int nrb = l_isfalse(rb); /* next assignment may change this value */ | 1509 | if (l_isfalse(rb)) |
1507 | setbvalue(s2v(ra), nrb); | 1510 | setbtvalue(s2v(ra)); |
1511 | else | ||
1512 | setbfvalue(s2v(ra)); | ||
1508 | vmbreak; | 1513 | vmbreak; |
1509 | } | 1514 | } |
1510 | vmcase(OP_LEN) { | 1515 | vmcase(OP_LEN) { |
diff --git a/testes/code.lua b/testes/code.lua index e12f3f91..34b04668 100644 --- a/testes/code.lua +++ b/testes/code.lua | |||
@@ -144,10 +144,10 @@ check(function (a,b,c,d) return a..b..c..d end, | |||
144 | 'MOVE', 'MOVE', 'MOVE', 'MOVE', 'CONCAT', 'RETURN1') | 144 | 'MOVE', 'MOVE', 'MOVE', 'MOVE', 'CONCAT', 'RETURN1') |
145 | 145 | ||
146 | -- not | 146 | -- not |
147 | check(function () return not not nil end, 'LOADBOOL', 'RETURN1') | 147 | check(function () return not not nil end, 'LOADFALSE', 'RETURN1') |
148 | check(function () return not not kFalse end, 'LOADBOOL', 'RETURN1') | 148 | check(function () return not not kFalse end, 'LOADFALSE', 'RETURN1') |
149 | check(function () return not not true end, 'LOADBOOL', 'RETURN1') | 149 | check(function () return not not true end, 'LOADTRUE', 'RETURN1') |
150 | check(function () return not not k3 end, 'LOADBOOL', 'RETURN1') | 150 | check(function () return not not k3 end, 'LOADTRUE', 'RETURN1') |
151 | 151 | ||
152 | -- direct access to locals | 152 | -- direct access to locals |
153 | check(function () | 153 | check(function () |
@@ -194,7 +194,7 @@ check(function () | |||
194 | local a,b | 194 | local a,b |
195 | a[kTrue] = false | 195 | a[kTrue] = false |
196 | end, | 196 | end, |
197 | 'LOADNIL', 'LOADBOOL', 'SETTABLE', 'RETURN0') | 197 | 'LOADNIL', 'LOADTRUE', 'SETTABLE', 'RETURN0') |
198 | 198 | ||
199 | 199 | ||
200 | -- equalities | 200 | -- equalities |