mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
rc: fix local variables in functions
reported by micah stetson: fn foo { echo $bar } bar=baz foo
This commit is contained in:
parent
0e430b25b2
commit
362264eb51
2 changed files with 4 additions and 4 deletions
|
@ -339,9 +339,9 @@ outcode(tree *t, int eflag)
|
|||
outcode(c0, eflag);
|
||||
emitf(Xlocal);
|
||||
}
|
||||
t = tt;
|
||||
outcode(c2, eflag);
|
||||
for(;t->type=='=';t = c2) emitf(Xunlocal);
|
||||
outcode(t, eflag);
|
||||
for(t = tt; t->type=='='; t = c2)
|
||||
emitf(Xunlocal);
|
||||
}
|
||||
else{
|
||||
for(t = tt;t;t = c2){
|
||||
|
|
|
@ -130,7 +130,7 @@ execfunc(var *func)
|
|||
starval = runq->argv->words;
|
||||
runq->argv->words = 0;
|
||||
poplist();
|
||||
start(func->fn, func->pc, (struct var *)0);
|
||||
start(func->fn, func->pc, runq->local);
|
||||
runq->local = newvar(strdup("*"), runq->local);
|
||||
runq->local->val = starval;
|
||||
runq->local->changed = 1;
|
||||
|
|
Loading…
Reference in a new issue