diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2017-12-22 19:51:04 +0000 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2017-12-22 19:51:04 +0000 |
commit | 8ec3d17b4ba5f19ae24695c9532606f7f266e1f1 (patch) | |
tree | 592c1468f4d06a39d14141921ecf1ddddabd2d97 /Src/exec.c | |
parent | 932ed864837b8c43e475784768bd0b00728e756c (diff) | |
download | zsh-8ec3d17b4ba5f19ae24695c9532606f7f266e1f1.tar.gz zsh-8ec3d17b4ba5f19ae24695c9532606f7f266e1f1.tar.xz zsh-8ec3d17b4ba5f19ae24695c9532606f7f266e1f1.zip |
33395: Improvments for function managment.
Functions defined inside other fucntions needs file line number adding. Particularly useful for anonymous fucntions. Add flag to indicate a function is anonymous. Done up to now by comparing the name to a pointer but this is more consistent.
Diffstat (limited to 'Src/exec.c')
-rw-r--r-- | Src/exec.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c index 3678ef84a..38cc24a12 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -5089,7 +5089,11 @@ execfuncdef(Estate state, Eprog redir_prog) shf->node.flags = 0; /* No dircache here, not a directory */ shf->filename = ztrdup(scriptfilename); - shf->lineno = lineno; + shf->lineno = + (funcstack && (funcstack->tp == FS_FUNC || + funcstack->tp == FS_EVAL)) ? + funcstack->flineno + lineno : + lineno; /* * redir_prog is permanently allocated --- but if * this function has multiple names we need an additional @@ -5109,6 +5113,7 @@ execfuncdef(Estate state, Eprog redir_prog) LinkList args; anon_func = 1; + shf->node.flags |= PM_ANONYMOUS; state->pc = end; end += *state->pc++; |