about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-09-29 21:46:58 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-09-29 21:46:58 +0000
commite3fd25b18198709348af195dedadaceb88feb568 (patch)
treec79923638294a83398fdda1aef2698deafef0399 /Src/exec.c
parent29db898a6d5eb41b4e3c8624bd1356d02571f5f0 (diff)
downloadzsh-e3fd25b18198709348af195dedadaceb88feb568.tar.gz
zsh-e3fd25b18198709348af195dedadaceb88feb568.tar.xz
zsh-e3fd25b18198709348af195dedadaceb88feb568.zip
25775: fix logical problem with function line numbering inside eval-style traps
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Src/exec.c b/Src/exec.c
index bf23a34da..1685c799e 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -992,7 +992,7 @@ execsimple(Estate state)
 	return (lastval = 1);
 
     /* In evaluated traps, don't modify the line number. */
-    if ((!intrap || trapisfunc) && !ineval && code)
+    if (!IN_EVAL_TRAP() && !ineval && code)
 	lineno = code - 1;
 
     code = wc_code(*state->pc++);
@@ -1053,7 +1053,7 @@ execlist(Estate state, int dont_change_job, int exiting)
 	ltype = WC_LIST_TYPE(code);
 	csp = cmdsp;
 
-	if ((!intrap || trapisfunc) && !ineval) {
+	if (!IN_EVAL_TRAP() && !ineval) {
 	    /*
 	     * Ensure we have a valid line number for debugging,
 	     * unless we are in an evaluated trap in which case
@@ -1543,7 +1543,7 @@ execpline2(Estate state, wordcode pcode,
 	return;
 
     /* In evaluated traps, don't modify the line number. */
-    if ((!intrap || trapisfunc) && !ineval && WC_PIPE_LINENO(pcode))
+    if (!IN_EVAL_TRAP() && !ineval && WC_PIPE_LINENO(pcode))
 	lineno = WC_PIPE_LINENO(pcode) - 1;
 
     if (pline_level == 1) {
@@ -4628,6 +4628,7 @@ execsave(void)
     es->trap_return = trap_return;
     es->trap_state = trap_state;
     es->trapisfunc = trapisfunc;
+    es->traplocallevel = traplocallevel;
     es->noerrs = noerrs;
     es->subsh_close = subsh_close;
     es->underscore = ztrdup(underscore);
@@ -4657,6 +4658,7 @@ execrestore(void)
     trap_return = exstack->trap_return;
     trap_state = exstack->trap_state;
     trapisfunc = exstack->trapisfunc;
+    traplocallevel = exstack->traplocallevel;
     noerrs = exstack->noerrs;
     subsh_close = exstack->subsh_close;
     setunderscore(exstack->underscore);