diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-02-28 14:19:47 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-02-28 14:19:47 -0300 |
commit | 6b6bc532a4f5e335540e6f19914cfe8435d064ed (patch) | |
tree | a7d456a86bf86ef6d6e1333d7372f17ad9562773 /lparser.c | |
parent | ea16ee41a8b0e6fe2c8f77e901a7d99173065beb (diff) | |
download | lua-6b6bc532a4f5e335540e6f19914cfe8435d064ed.tar.gz lua-6b6bc532a4f5e335540e6f19914cfe8435d064ed.tar.bz2 lua-6b6bc532a4f5e335540e6f19914cfe8435d064ed.zip |
better error message for (deprecated) "%global"
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.205 2003/02/11 10:49:53 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.206 2003/02/18 16:02:56 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -240,8 +240,10 @@ static void singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { | |||
240 | } | 240 | } |
241 | 241 | ||
242 | 242 | ||
243 | static void singlevar (LexState *ls, expdesc *var, int base) { | 243 | static TString *singlevar (LexState *ls, expdesc *var, int base) { |
244 | singlevaraux(ls->fs, str_checkname(ls), var, base); | 244 | TString *varname = str_checkname(ls); |
245 | singlevaraux(ls->fs, varname, var, base); | ||
246 | return varname; | ||
245 | } | 247 | } |
246 | 248 | ||
247 | 249 | ||
@@ -645,9 +647,13 @@ static void prefixexp (LexState *ls, expdesc *v) { | |||
645 | } | 647 | } |
646 | #ifdef LUA_COMPATUPSYNTAX | 648 | #ifdef LUA_COMPATUPSYNTAX |
647 | case '%': { /* for compatibility only */ | 649 | case '%': { /* for compatibility only */ |
650 | TString *varname; | ||
651 | int line = ls->linenumber; | ||
648 | next(ls); /* skip `%' */ | 652 | next(ls); /* skip `%' */ |
649 | singlevar(ls, v, 1); | 653 | varname = singlevar(ls, v, 1); |
650 | check_condition(ls, v->k == VUPVAL, "global upvalues are obsolete"); | 654 | if (v->k != VUPVAL) |
655 | luaX_errorline(ls, "global upvalues are obsolete", | ||
656 | getstr(varname), line); | ||
651 | return; | 657 | return; |
652 | } | 658 | } |
653 | #endif | 659 | #endif |