aboutsummaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-06-18 16:45:55 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-06-18 16:45:55 -0300
commit07b009c3712c062957593d0a4fa82e0fe9023024 (patch)
tree1628514f820fdbf452d6e9c524a22d3dd14198b2 /lparser.c
parentf71156744851701b5d5fabdda5061b31e53f8f14 (diff)
downloadlua-07b009c3712c062957593d0a4fa82e0fe9023024.tar.gz
lua-07b009c3712c062957593d0a4fa82e0fe9023024.tar.bz2
lua-07b009c3712c062957593d0a4fa82e0fe9023024.zip
No need to limit variable declarations to 250
Only local variables, which use registers, need this low limit.
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lparser.c b/lparser.c
index 9abaa374..201dbe8b 100644
--- a/lparser.c
+++ b/lparser.c
@@ -50,7 +50,7 @@ typedef struct BlockCnt {
50 struct BlockCnt *previous; /* chain */ 50 struct BlockCnt *previous; /* chain */
51 int firstlabel; /* index of first label in this block */ 51 int firstlabel; /* index of first label in this block */
52 int firstgoto; /* index of first pending goto in this block */ 52 int firstgoto; /* index of first pending goto in this block */
53 lu_byte nactvar; /* # active locals outside the block */ 53 short nactvar; /* number of active declarations at block entry */
54 lu_byte upval; /* true if some variable in the block is an upvalue */ 54 lu_byte upval; /* true if some variable in the block is an upvalue */
55 lu_byte isloop; /* 1 if 'block' is a loop; 2 if it has pending breaks */ 55 lu_byte isloop; /* 1 if 'block' is a loop; 2 if it has pending breaks */
56 lu_byte insidetbc; /* true if inside the scope of a to-be-closed var. */ 56 lu_byte insidetbc; /* true if inside the scope of a to-be-closed var. */
@@ -196,8 +196,6 @@ static int new_varkind (LexState *ls, TString *name, lu_byte kind) {
196 FuncState *fs = ls->fs; 196 FuncState *fs = ls->fs;
197 Dyndata *dyd = ls->dyd; 197 Dyndata *dyd = ls->dyd;
198 Vardesc *var; 198 Vardesc *var;
199 luaY_checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal,
200 MAXVARS, "local variables");
201 luaM_growvector(L, dyd->actvar.arr, dyd->actvar.n + 1, 199 luaM_growvector(L, dyd->actvar.arr, dyd->actvar.n + 1,
202 dyd->actvar.size, Vardesc, SHRT_MAX, "variable declarationss"); 200 dyd->actvar.size, Vardesc, SHRT_MAX, "variable declarationss");
203 var = &dyd->actvar.arr[dyd->actvar.n++]; 201 var = &dyd->actvar.arr[dyd->actvar.n++];
@@ -330,6 +328,7 @@ static void adjustlocalvars (LexState *ls, int nvars) {
330 Vardesc *var = getlocalvardesc(fs, vidx); 328 Vardesc *var = getlocalvardesc(fs, vidx);
331 var->vd.ridx = cast_byte(reglevel++); 329 var->vd.ridx = cast_byte(reglevel++);
332 var->vd.pidx = registerlocalvar(ls, fs, var->vd.name); 330 var->vd.pidx = registerlocalvar(ls, fs, var->vd.name);
331 luaY_checklimit(fs, reglevel, MAXVARS, "local variables");
333 } 332 }
334} 333}
335 334