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);
|
outcode(c0, eflag);
|
||||||
emitf(Xlocal);
|
emitf(Xlocal);
|
||||||
}
|
}
|
||||||
t = tt;
|
outcode(t, eflag);
|
||||||
outcode(c2, eflag);
|
for(t = tt; t->type=='='; t = c2)
|
||||||
for(;t->type=='=';t = c2) emitf(Xunlocal);
|
emitf(Xunlocal);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
for(t = tt;t;t = c2){
|
for(t = tt;t;t = c2){
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ execfunc(var *func)
|
||||||
starval = runq->argv->words;
|
starval = runq->argv->words;
|
||||||
runq->argv->words = 0;
|
runq->argv->words = 0;
|
||||||
poplist();
|
poplist();
|
||||||
start(func->fn, func->pc, (struct var *)0);
|
start(func->fn, func->pc, runq->local);
|
||||||
runq->local = newvar(strdup("*"), runq->local);
|
runq->local = newvar(strdup("*"), runq->local);
|
||||||
runq->local->val = starval;
|
runq->local->val = starval;
|
||||||
runq->local->changed = 1;
|
runq->local->changed = 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue