Revert "Lua 'global' keyword, only for functions for now because I'm tired"

This reverts commit db4dc10100.
This commit is contained in:
James R 2020-01-17 14:54:22 -08:00
parent c097101e48
commit ffbca6a646
3 changed files with 2 additions and 18 deletions

View file

@ -38,7 +38,7 @@
const char *const luaX_tokens [] = {
"and", "break", "continue", "do", "else", "elseif",
"end", "false", "for", "function", "if",
"in", "local", "global", "nil", "not", "or", "repeat",
"in", "local", "nil", "not", "or", "repeat",
"return", "then", "true", "until", "while",
"..", "...", "==", ">=", "<=", "~=",
"<number>", "<name>", "<string>", "<eof>",

View file

@ -25,7 +25,7 @@ enum RESERVED {
/* terminal symbols denoted by reserved words */
TK_AND = FIRST_RESERVED, TK_BREAK, TK_CONTINUE,
TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
TK_IF, TK_IN, TK_LOCAL, TK_GLOBAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
/* other terminal symbols */
TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,

View file

@ -1349,16 +1349,6 @@ static void localfunc (LexState *ls) {
}
static void globalfunc (LexState *ls) {
expdesc v, b;
FuncState *fs = ls->fs;
init_exp(&v, VGLOBAL, NO_REG);
v.u.s.info = luaK_stringK(fs, str_checkname(ls));
body(ls, &b, 0, ls->linenumber);
luaK_storevar(fs, &v, &b);
}
static void localstat (LexState *ls) {
/* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */
int nvars = 0;
@ -1498,12 +1488,6 @@ static int statement (LexState *ls) {
localstat(ls);
return 0;
}
case TK_GLOBAL: { /* stat -> globalstat */
luaX_next(ls); /* skip GLOBAL */
if (testnext(ls, TK_FUNCTION))
globalfunc(ls);
return 0;
}
case TK_RETURN: { /* stat -> retstat */
retstat(ls);
return 1; /* must be last statement */