aboutsummaryrefslogtreecommitdiff
path: root/lua.stx
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-01-12 11:35:37 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-01-12 11:35:37 -0200
commitf0dffaa209d80b9852e873830243245c1facdd05 (patch)
tree562ac67e30c59242ae862bb3db2f4c7a670565b9 /lua.stx
parent77a6836fef12a6383d1c9eb1587aa5afa30c9b5a (diff)
downloadlua-f0dffaa209d80b9852e873830243245c1facdd05.tar.gz
lua-f0dffaa209d80b9852e873830243245c1facdd05.tar.bz2
lua-f0dffaa209d80b9852e873830243245c1facdd05.zip
new way to hanlde arg information
Diffstat (limited to 'lua.stx')
-rw-r--r--lua.stx15
1 files changed, 10 insertions, 5 deletions
diff --git a/lua.stx b/lua.stx
index b10ea3bb..0208a638 100644
--- a/lua.stx
+++ b/lua.stx
@@ -1,6 +1,6 @@
1%{ 1%{
2/* 2/*
3** $Id: lua.stx,v 1.31 1997/12/30 19:08:23 roberto Exp roberto $ 3** $Id: lua.stx,v 1.32 1998/01/12 13:00:51 roberto Exp roberto $
4** Syntax analizer and code generator 4** Syntax analizer and code generator
5** See Copyright Notice in lua.h 5** See Copyright Notice in lua.h
6*/ 6*/
@@ -448,11 +448,15 @@ static void adjust_mult_assign (int vars, long exps)
448 448
449static void code_args (int nparams, int dots) 449static void code_args (int nparams, int dots)
450{ 450{
451 L->currState->nlocalvar += nparams; 451 L->currState->nlocalvar += nparams; /* "self" may already be there */
452 if (!dots) 452 nparams = L->currState->nlocalvar;
453 code_oparg(ARGS, 4, L->currState->nlocalvar, L->currState->nlocalvar); 453 if (!dots) {
454 L->currState->f->code[1] = nparams; /* fill-in arg information */
455 deltastack(nparams);
456 }
454 else { 457 else {
455 code_oparg(VARARGS, 0, L->currState->nlocalvar, L->currState->nlocalvar+1); 458 L->currState->f->code[1] = nparams+ZEROVARARG;
459 deltastack(nparams+1);
456 add_localvar(luaS_new("arg")); 460 add_localvar(luaS_new("arg"));
457 } 461 }
458} 462}
@@ -577,6 +581,7 @@ static void init_state (TaggedString *filename)
577 else 581 else
578 fs->maxvars = -1; /* flag no debug information */ 582 fs->maxvars = -1; /* flag no debug information */
579 code_byte(0); /* to be filled with stacksize */ 583 code_byte(0); /* to be filled with stacksize */
584 code_byte(0); /* to be filled with arg information */
580 L->lexstate->lastline = 0; /* invalidate it */ 585 L->lexstate->lastline = 0; /* invalidate it */
581} 586}
582 587