Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fded0b4

Browse files
committed
Remove compat code in parser when not needed
1 parent 3b9dd52 commit fded0b4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

llex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r')
4242

4343
#if defined(LUA_COMPAT_GLOBAL)
44-
#define GLOBALLEX ".g" /* not recognizable by the scanner */
44+
#define GLOBALLEX ".g" /* anything not recognizable as a name */
4545
#else
4646
#define GLOBALLEX "global"
4747
#endif

lparser.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,7 @@ static void statement (LexState *ls) {
19971997
gotostat(ls, line);
19981998
break;
19991999
}
2000+
#if defined(LUA_COMPAT_GLOBAL)
20002001
case TK_NAME: {
20012002
/* compatibility code to parse global keyword when "global"
20022003
is not reserved */
@@ -2008,7 +2009,9 @@ static void statement (LexState *ls) {
20082009
break;
20092010
}
20102011
} /* else... */
2011-
} /* FALLTHROUGH */
2012+
}
2013+
#endif
2014+
/* FALLTHROUGH */
20122015
default: { /* stat -> func | assignment */
20132016
exprstat(ls);
20142017
break;

0 commit comments

Comments
 (0)