diff options
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.87 2010/05/31 16:08:55 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.88 2010/06/21 16:30:12 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -138,7 +138,7 @@ static TString *str_checkname (LexState *ls) { | |||
138 | static void init_exp (expdesc *e, expkind k, int i) { | 138 | static void init_exp (expdesc *e, expkind k, int i) { |
139 | e->f = e->t = NO_JUMP; | 139 | e->f = e->t = NO_JUMP; |
140 | e->k = k; | 140 | e->k = k; |
141 | e->u.s.info = i; | 141 | e->u.info = i; |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
@@ -226,7 +226,7 @@ static int newupvalue (FuncState *fs, TString *name, expdesc *v) { | |||
226 | Upvaldesc, MAXUPVAL, "upvalues"); | 226 | Upvaldesc, MAXUPVAL, "upvalues"); |
227 | while (oldsize < f->sizeupvalues) f->upvalues[oldsize++].name = NULL; | 227 | while (oldsize < f->sizeupvalues) f->upvalues[oldsize++].name = NULL; |
228 | f->upvalues[fs->nups].instack = (v->k == VLOCAL); | 228 | f->upvalues[fs->nups].instack = (v->k == VLOCAL); |
229 | f->upvalues[fs->nups].idx = cast_byte(v->u.s.info); | 229 | f->upvalues[fs->nups].idx = cast_byte(v->u.info); |
230 | f->upvalues[fs->nups].name = name; | 230 | f->upvalues[fs->nups].name = name; |
231 | luaC_objbarrier(fs->L, f, name); | 231 | luaC_objbarrier(fs->L, f, name); |
232 | return fs->nups++; | 232 | return fs->nups++; |
@@ -518,7 +518,7 @@ static void recfield (LexState *ls, struct ConsControl *cc) { | |||
518 | checknext(ls, '='); | 518 | checknext(ls, '='); |
519 | rkkey = luaK_exp2RK(fs, &key); | 519 | rkkey = luaK_exp2RK(fs, &key); |
520 | expr(ls, &val); | 520 | expr(ls, &val); |
521 | luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val)); | 521 | luaK_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, luaK_exp2RK(fs, &val)); |
522 | fs->freereg = reg; /* free registers */ | 522 | fs->freereg = reg; /* free registers */ |
523 | } | 523 | } |
524 | 524 | ||
@@ -528,7 +528,7 @@ static void closelistfield (FuncState *fs, struct ConsControl *cc) { | |||
528 | luaK_exp2nextreg(fs, &cc->v); | 528 | luaK_exp2nextreg(fs, &cc->v); |
529 | cc->v.k = VVOID; | 529 | cc->v.k = VVOID; |
530 | if (cc->tostore == LFIELDS_PER_FLUSH) { | 530 | if (cc->tostore == LFIELDS_PER_FLUSH) { |
531 | luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); /* flush */ | 531 | luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); /* flush */ |
532 | cc->tostore = 0; /* no more items pending */ | 532 | cc->tostore = 0; /* no more items pending */ |
533 | } | 533 | } |
534 | } | 534 | } |
@@ -538,13 +538,13 @@ static void lastlistfield (FuncState *fs, struct ConsControl *cc) { | |||
538 | if (cc->tostore == 0) return; | 538 | if (cc->tostore == 0) return; |
539 | if (hasmultret(cc->v.k)) { | 539 | if (hasmultret(cc->v.k)) { |
540 | luaK_setmultret(fs, &cc->v); | 540 | luaK_setmultret(fs, &cc->v); |
541 | luaK_setlist(fs, cc->t->u.s.info, cc->na, LUA_MULTRET); | 541 | luaK_setlist(fs, cc->t->u.info, cc->na, LUA_MULTRET); |
542 | cc->na--; /* do not count last expression (unknown number of elements) */ | 542 | cc->na--; /* do not count last expression (unknown number of elements) */ |
543 | } | 543 | } |
544 | else { | 544 | else { |
545 | if (cc->v.k != VVOID) | 545 | if (cc->v.k != VVOID) |
546 | luaK_exp2nextreg(fs, &cc->v); | 546 | luaK_exp2nextreg(fs, &cc->v); |
547 | luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); | 547 | luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); |
548 | } | 548 | } |
549 | } | 549 | } |
550 | 550 | ||
@@ -702,7 +702,7 @@ static void funcargs (LexState *ls, expdesc *f, int line) { | |||
702 | } | 702 | } |
703 | } | 703 | } |
704 | lua_assert(f->k == VNONRELOC); | 704 | lua_assert(f->k == VNONRELOC); |
705 | base = f->u.s.info; /* base register for call */ | 705 | base = f->u.info; /* base register for call */ |
706 | if (hasmultret(args.k)) | 706 | if (hasmultret(args.k)) |
707 | nparams = LUA_MULTRET; /* open call */ | 707 | nparams = LUA_MULTRET; /* open call */ |
708 | else { | 708 | else { |
@@ -976,20 +976,20 @@ static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v, | |||
976 | int conflict = 0; | 976 | int conflict = 0; |
977 | for (; lh; lh = lh->prev) { | 977 | for (; lh; lh = lh->prev) { |
978 | if (lh->v.k == ix) { | 978 | if (lh->v.k == ix) { |
979 | if (lh->v.u.s.info == v->u.s.info) { /* conflict? */ | 979 | if (lh->v.u.ind.t == v->u.info) { /* conflict? */ |
980 | conflict = 1; | 980 | conflict = 1; |
981 | lh->v.k = VINDEXED; | 981 | lh->v.k = VINDEXED; |
982 | lh->v.u.s.info = extra; /* previous assignment will use safe copy */ | 982 | lh->v.u.ind.t = extra; /* previous assignment will use safe copy */ |
983 | } | 983 | } |
984 | if (v->k == VLOCAL && lh->v.u.s.aux == v->u.s.info) { /* conflict? */ | 984 | if (v->k == VLOCAL && lh->v.u.ind.idx == v->u.info) { /* conflict? */ |
985 | conflict = 1; | 985 | conflict = 1; |
986 | lua_assert(lh->v.k == VINDEXED); | 986 | lua_assert(lh->v.k == VINDEXED); |
987 | lh->v.u.s.aux = extra; /* previous assignment will use safe copy */ | 987 | lh->v.u.ind.idx = extra; /* previous assignment will use safe copy */ |
988 | } | 988 | } |
989 | } | 989 | } |
990 | } | 990 | } |
991 | if (conflict) { | 991 | if (conflict) { |
992 | luaK_codeABC(fs, op, fs->freereg, v->u.s.info, 0); /* make copy */ | 992 | luaK_codeABC(fs, op, fs->freereg, v->u.info, 0); /* make copy */ |
993 | luaK_reserveregs(fs, 1); | 993 | luaK_reserveregs(fs, 1); |
994 | } | 994 | } |
995 | } | 995 | } |
@@ -1108,7 +1108,7 @@ static int exp1 (LexState *ls) { | |||
1108 | expr(ls, &e); | 1108 | expr(ls, &e); |
1109 | luaK_exp2nextreg(ls->fs, &e); | 1109 | luaK_exp2nextreg(ls->fs, &e); |
1110 | lua_assert(e.k == VNONRELOC); | 1110 | lua_assert(e.k == VNONRELOC); |
1111 | reg = e.u.s.info; | 1111 | reg = e.u.info; |
1112 | return reg; | 1112 | return reg; |
1113 | } | 1113 | } |
1114 | 1114 | ||