diff options
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 22 |
1 files changed, 8 insertions, 14 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.102 2000/06/30 14:35:17 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.103 2000/08/08 18:26:05 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 | */ |
@@ -154,13 +154,11 @@ static int checkname (LexState *ls) { | |||
154 | 154 | ||
155 | static void luaI_registerlocalvar (LexState *ls, TString *varname, int pc) { | 155 | static void luaI_registerlocalvar (LexState *ls, TString *varname, int pc) { |
156 | FuncState *fs = ls->fs; | 156 | FuncState *fs = ls->fs; |
157 | if (fs->debug) { | 157 | Proto *f = fs->f; |
158 | Proto *f = fs->f; | 158 | luaM_growvector(ls->L, f->locvars, fs->nvars, 1, LocVar, "", MAX_INT); |
159 | luaM_growvector(ls->L, f->locvars, fs->nvars, 1, LocVar, "", MAX_INT); | 159 | f->locvars[fs->nvars].varname = varname; |
160 | f->locvars[fs->nvars].varname = varname; | 160 | f->locvars[fs->nvars].pc = pc; |
161 | f->locvars[fs->nvars].pc = pc; | 161 | fs->nvars++; |
162 | fs->nvars++; | ||
163 | } | ||
164 | } | 162 | } |
165 | 163 | ||
166 | 164 | ||
@@ -350,10 +348,8 @@ static void close_func (LexState *ls) { | |||
350 | luaM_reallocvector(L, f->kproto, f->nkproto, Proto *); | 348 | luaM_reallocvector(L, f->kproto, f->nkproto, Proto *); |
351 | luaI_registerlocalvar(ls, NULL, -1); /* flag end of vector */ | 349 | luaI_registerlocalvar(ls, NULL, -1); /* flag end of vector */ |
352 | luaM_reallocvector(L, f->locvars, fs->nvars, LocVar); | 350 | luaM_reallocvector(L, f->locvars, fs->nvars, LocVar); |
353 | if (fs->debug) { | 351 | luaM_reallocvector(L, f->lineinfo, fs->nlineinfo+1, int); |
354 | luaM_reallocvector(L, f->lineinfo, fs->nlineinfo+1, int); | 352 | f->lineinfo[fs->nlineinfo] = MAX_INT; /* end flag */ |
355 | f->lineinfo[fs->nlineinfo] = MAX_INT; /* end flag */ | ||
356 | } | ||
357 | ls->fs = fs->prev; | 353 | ls->fs = fs->prev; |
358 | LUA_ASSERT(fs->bl == NULL, "wrong list end"); | 354 | LUA_ASSERT(fs->bl == NULL, "wrong list end"); |
359 | } | 355 | } |
@@ -365,7 +361,6 @@ Proto *luaY_parser (lua_State *L, ZIO *z) { | |||
365 | luaX_setinput(L, &lexstate, z, luaS_new(L, zname(z))); | 361 | luaX_setinput(L, &lexstate, z, luaS_new(L, zname(z))); |
366 | open_func(&lexstate, &funcstate); | 362 | open_func(&lexstate, &funcstate); |
367 | next(&lexstate); /* read first token */ | 363 | next(&lexstate); /* read first token */ |
368 | funcstate.debug = L->debug; /* previous `next' may scan a pragma */ | ||
369 | chunk(&lexstate); | 364 | chunk(&lexstate); |
370 | check_condition(&lexstate, (lexstate.t.token == TK_EOS), "<eof> expected"); | 365 | check_condition(&lexstate, (lexstate.t.token == TK_EOS), "<eof> expected"); |
371 | close_func(&lexstate); | 366 | close_func(&lexstate); |
@@ -1091,7 +1086,6 @@ static void body (LexState *ls, int needself, int line) { | |||
1091 | FuncState new_fs; | 1086 | FuncState new_fs; |
1092 | open_func(ls, &new_fs); | 1087 | open_func(ls, &new_fs); |
1093 | new_fs.f->lineDefined = line; | 1088 | new_fs.f->lineDefined = line; |
1094 | new_fs.debug = ls->L->debug; | ||
1095 | check(ls, '('); | 1089 | check(ls, '('); |
1096 | if (needself) { | 1090 | if (needself) { |
1097 | new_localvarstr(ls, "self", 0); | 1091 | new_localvarstr(ls, "self", 0); |