aboutsummaryrefslogtreecommitdiff
path: root/src/lua/lparser.c
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-03-03 21:31:01 +0800
committerLi Jin <dragon-fly@qq.com>2021-03-03 21:33:37 +0800
commit1df786307c1983b8ce693e3916081a8bcd4e95ae (patch)
tree6c7aeb2198d825877fd3d179c394b7a5c1f06a17 /src/lua/lparser.c
parent66168b112b707172b9035edf8c1daed469781e06 (diff)
downloadyuescript-1df786307c1983b8ce693e3916081a8bcd4e95ae.tar.gz
yuescript-1df786307c1983b8ce693e3916081a8bcd4e95ae.tar.bz2
yuescript-1df786307c1983b8ce693e3916081a8bcd4e95ae.zip
add new metatable syntax for issue #41, fix reusing local variable issue, update built-in Lua.
Diffstat (limited to 'src/lua/lparser.c')
-rw-r--r--src/lua/lparser.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lua/lparser.c b/src/lua/lparser.c
index 249ba9a..284ef1f 100644
--- a/src/lua/lparser.c
+++ b/src/lua/lparser.c
@@ -128,7 +128,7 @@ static void checknext (LexState *ls, int c) {
128** in line 'where' (if that is not the current line). 128** in line 'where' (if that is not the current line).
129*/ 129*/
130static void check_match (LexState *ls, int what, int who, int where) { 130static void check_match (LexState *ls, int what, int who, int where) {
131 if (unlikely(!testnext(ls, what))) { 131 if (l_unlikely(!testnext(ls, what))) {
132 if (where == ls->linenumber) /* all in the same line? */ 132 if (where == ls->linenumber) /* all in the same line? */
133 error_expected(ls, what); /* do not need a complex message */ 133 error_expected(ls, what); /* do not need a complex message */
134 else { 134 else {
@@ -517,7 +517,7 @@ static void solvegoto (LexState *ls, int g, Labeldesc *label) {
517 Labellist *gl = &ls->dyd->gt; /* list of goto's */ 517 Labellist *gl = &ls->dyd->gt; /* list of goto's */
518 Labeldesc *gt = &gl->arr[g]; /* goto to be resolved */ 518 Labeldesc *gt = &gl->arr[g]; /* goto to be resolved */
519 lua_assert(eqstr(gt->name, label->name)); 519 lua_assert(eqstr(gt->name, label->name));
520 if (unlikely(gt->nactvar < label->nactvar)) /* enter some scope? */ 520 if (l_unlikely(gt->nactvar < label->nactvar)) /* enter some scope? */
521 jumpscopeerror(ls, gt); 521 jumpscopeerror(ls, gt);
522 luaK_patchlist(ls->fs, gt->pc, label->pc); 522 luaK_patchlist(ls->fs, gt->pc, label->pc);
523 for (i = g; i < gl->n - 1; i++) /* remove goto from pending list */ 523 for (i = g; i < gl->n - 1; i++) /* remove goto from pending list */
@@ -1435,7 +1435,7 @@ static void breakstat (LexState *ls) {
1435*/ 1435*/
1436static void checkrepeated (LexState *ls, TString *name) { 1436static void checkrepeated (LexState *ls, TString *name) {
1437 Labeldesc *lb = findlabel(ls, name); 1437 Labeldesc *lb = findlabel(ls, name);
1438 if (unlikely(lb != NULL)) { /* already defined? */ 1438 if (l_unlikely(lb != NULL)) { /* already defined? */
1439 const char *msg = "label '%s' already defined on line %d"; 1439 const char *msg = "label '%s' already defined on line %d";
1440 msg = luaO_pushfstring(ls->L, msg, getstr(name), lb->line); 1440 msg = luaO_pushfstring(ls->L, msg, getstr(name), lb->line);
1441 luaK_semerror(ls, msg); /* error */ 1441 luaK_semerror(ls, msg); /* error */
@@ -1520,7 +1520,7 @@ static void fixforjump (FuncState *fs, int pc, int dest, int back) {
1520 int offset = dest - (pc + 1); 1520 int offset = dest - (pc + 1);
1521 if (back) 1521 if (back)
1522 offset = -offset; 1522 offset = -offset;
1523 if (unlikely(offset > MAXARG_Bx)) 1523 if (l_unlikely(offset > MAXARG_Bx))
1524 luaX_syntaxerror(fs->ls, "control structure too long"); 1524 luaX_syntaxerror(fs->ls, "control structure too long");
1525 SETARG_Bx(*jmp, offset); 1525 SETARG_Bx(*jmp, offset);
1526} 1526}