mirror of https://github.com/rusefi/lua.git
details.
This commit is contained in:
parent
40f4e931f3
commit
f8509668dc
10
lparser.c
10
lparser.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lparser.c,v 1.132 2001/02/09 20:22:29 roberto Exp roberto $
|
||||
** $Id: lparser.c,v 1.133 2001/02/14 17:19:28 roberto Exp roberto $
|
||||
** LL(1) Parser and code generator for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -209,7 +209,8 @@ static int search_local (LexState *ls, TString *n, expdesc *var) {
|
|||
static void singlevar (LexState *ls, TString *n, expdesc *var) {
|
||||
int level = search_local(ls, n, var);
|
||||
if (level >= 1) /* neither local (0) nor global (-1)? */
|
||||
luaX_syntaxerror(ls, "cannot access a variable in outer scope", getstr(n));
|
||||
luaX_syntaxerror(ls, "cannot access a variable in outer function",
|
||||
getstr(n));
|
||||
else if (level == -1) /* global? */
|
||||
var->u.index = string_constant(ls->fs, n);
|
||||
}
|
||||
|
@ -238,9 +239,10 @@ static void pushupvalue (LexState *ls, TString *n) {
|
|||
luaX_syntaxerror(ls, "cannot access an upvalue at top level", getstr(n));
|
||||
v.u.index = string_constant(fs->prev, n);
|
||||
}
|
||||
else if (level != 1)
|
||||
else if (level != 1) {
|
||||
luaX_syntaxerror(ls,
|
||||
"upvalue must be global or local to immediately outer scope", getstr(n));
|
||||
"upvalue must be global or local to immediately outer function", getstr(n));
|
||||
}
|
||||
luaK_code1(fs, OP_PUSHUPVALUE, indexupvalue(ls, &v));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue