diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-14 15:38:45 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-14 15:38:45 -0200 |
commit | f8509668dcb0e2f3842b9d0a58232f3ffa2f96d6 (patch) | |
tree | cc5c43884508d8cd077628df3a7433f5971a1bc4 /lparser.c | |
parent | 40f4e931f317f56725cba0b61ed82c0688a821f6 (diff) | |
download | lua-f8509668dcb0e2f3842b9d0a58232f3ffa2f96d6.tar.gz lua-f8509668dcb0e2f3842b9d0a58232f3ffa2f96d6.tar.bz2 lua-f8509668dcb0e2f3842b9d0a58232f3ffa2f96d6.zip |
details.
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.132 2001/02/09 20:22:29 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.133 2001/02/14 17:19:28 roberto Exp roberto $ |
3 | ** LL(1) Parser and code generator for Lua | 3 | ** LL(1) Parser and code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -209,7 +209,8 @@ static int search_local (LexState *ls, TString *n, expdesc *var) { | |||
209 | static void singlevar (LexState *ls, TString *n, expdesc *var) { | 209 | static void singlevar (LexState *ls, TString *n, expdesc *var) { |
210 | int level = search_local(ls, n, var); | 210 | int level = search_local(ls, n, var); |
211 | if (level >= 1) /* neither local (0) nor global (-1)? */ | 211 | if (level >= 1) /* neither local (0) nor global (-1)? */ |
212 | luaX_syntaxerror(ls, "cannot access a variable in outer scope", getstr(n)); | 212 | luaX_syntaxerror(ls, "cannot access a variable in outer function", |
213 | getstr(n)); | ||
213 | else if (level == -1) /* global? */ | 214 | else if (level == -1) /* global? */ |
214 | var->u.index = string_constant(ls->fs, n); | 215 | var->u.index = string_constant(ls->fs, n); |
215 | } | 216 | } |
@@ -238,9 +239,10 @@ static void pushupvalue (LexState *ls, TString *n) { | |||
238 | luaX_syntaxerror(ls, "cannot access an upvalue at top level", getstr(n)); | 239 | luaX_syntaxerror(ls, "cannot access an upvalue at top level", getstr(n)); |
239 | v.u.index = string_constant(fs->prev, n); | 240 | v.u.index = string_constant(fs->prev, n); |
240 | } | 241 | } |
241 | else if (level != 1) | 242 | else if (level != 1) { |
242 | luaX_syntaxerror(ls, | 243 | luaX_syntaxerror(ls, |
243 | "upvalue must be global or local to immediately outer scope", getstr(n)); | 244 | "upvalue must be global or local to immediately outer function", getstr(n)); |
245 | } | ||
244 | luaK_code1(fs, OP_PUSHUPVALUE, indexupvalue(ls, &v)); | 246 | luaK_code1(fs, OP_PUSHUPVALUE, indexupvalue(ls, &v)); |
245 | } | 247 | } |
246 | 248 | ||