aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lcode.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/lcode.c b/lcode.c
index ec255a0f..23969a69 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 2.48 2010/07/02 20:42:40 roberto Exp roberto $ 2** $Id: lcode.c,v 2.49 2010/07/07 16:27:29 roberto Exp roberto $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -603,21 +603,14 @@ void luaK_goiftrue (FuncState *fs, expdesc *e) {
603 int pc; /* pc of last jump */ 603 int pc; /* pc of last jump */
604 luaK_dischargevars(fs, e); 604 luaK_dischargevars(fs, e);
605 switch (e->k) { 605 switch (e->k) {
606 case VK: case VKNUM: case VTRUE: {
607 pc = NO_JUMP; /* always true; do nothing */
608 break;
609 }
610 case VJMP: { 606 case VJMP: {
611 invertjump(fs, e); 607 invertjump(fs, e);
612 pc = e->u.info; 608 pc = e->u.info;
613 break; 609 break;
614 } 610 }
615 case VFALSE: { 611 case VK: case VKNUM: case VTRUE: {
616 if (!hasjumps(e)) { 612 pc = NO_JUMP; /* always true; do nothing */
617 pc = luaK_jump(fs); /* always jump */ 613 break;
618 break;
619 }
620 /* else go through */
621 } 614 }
622 default: { 615 default: {
623 pc = jumponcond(fs, e, 0); 616 pc = jumponcond(fs, e, 0);
@@ -634,20 +627,13 @@ static void luaK_goiffalse (FuncState *fs, expdesc *e) {
634 int pc; /* pc of last jump */ 627 int pc; /* pc of last jump */
635 luaK_dischargevars(fs, e); 628 luaK_dischargevars(fs, e);
636 switch (e->k) { 629 switch (e->k) {
637 case VNIL: case VFALSE: {
638 pc = NO_JUMP; /* always false; do nothing */
639 break;
640 }
641 case VJMP: { 630 case VJMP: {
642 pc = e->u.info; 631 pc = e->u.info;
643 break; 632 break;
644 } 633 }
645 case VTRUE: { 634 case VNIL: case VFALSE: {
646 if (!hasjumps(e)) { 635 pc = NO_JUMP; /* always false; do nothing */
647 pc = luaK_jump(fs); /* always jump */ 636 break;
648 break;
649 }
650 /* else go through */
651 } 637 }
652 default: { 638 default: {
653 pc = jumponcond(fs, e, 1); 639 pc = jumponcond(fs, e, 1);