diff options
Diffstat (limited to 'functions.c')
-rw-r--r-- | functions.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/functions.c b/functions.c index 0dd898d..102590d 100644 --- a/functions.c +++ b/functions.c @@ -135,6 +135,7 @@ runfunc(Function f, Array *left, Array *right) Rune *code; Datum *lefto = nil; Datum *righto = nil; + if(f.type == FunctypeDfn) code = f.dfn; else{ @@ -143,9 +144,10 @@ runfunc(Function f, Array *left, Array *right) code = f.operator.dop; } - pushdfnframe(code, f.scope, lefto, righto, left, right); + DfnFrame *fr = pushdfnframe(code, f.scope, lefto, righto, left, right); Datum *dfnres = evalline(code, nil, 0); - popdfnframe(); + if(fr == getcurrentdfn()) + popdfnframe(); result = dfnres->array; /* TODO what if the evaluation failed */ if(dfnres->tag != ArrayTag || result == nil) |