diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-12 11:35:37 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-12 11:35:37 -0200 |
commit | f0dffaa209d80b9852e873830243245c1facdd05 (patch) | |
tree | 562ac67e30c59242ae862bb3db2f4c7a670565b9 /lua.stx | |
parent | 77a6836fef12a6383d1c9eb1587aa5afa30c9b5a (diff) | |
download | lua-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.stx | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -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 | ||
449 | static void code_args (int nparams, int dots) | 449 | static 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 | ||