about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2014-06-13 21:39:44 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-06-13 21:39:44 +0100
commitb5198b10a1d1b6a15c583eecf12fda0c08b19ad6 (patch)
tree9f4c71809d8480bfb3e771fdfdd70439c29df50e /Src/exec.c
parentd6698d89a6ff9e644ee608c1d08ff21911f9fb27 (diff)
downloadzsh-b5198b10a1d1b6a15c583eecf12fda0c08b19ad6.tar.gz
zsh-b5198b10a1d1b6a15c583eecf12fda0c08b19ad6.tar.xz
zsh-b5198b10a1d1b6a15c583eecf12fda0c08b19ad6.zip
32768 with further modifications: LOCAL_LOOPS option.
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 8249deff2..5ad957f98 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4614,7 +4614,7 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
     char *name = shfunc->node.nam;
     int flags = shfunc->node.flags, ooflags;
     char *fname = dupstring(name);
-    int obreaks, saveemulation, restore_sticky;
+    int obreaks, ocontflag, oloops, saveemulation, restore_sticky;
     Eprog prog;
     struct funcstack fstack;
     static int oflags;
@@ -4626,7 +4626,9 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
     pushheap();
 
     oargv0 = NULL;
-    obreaks = breaks;;
+    obreaks = breaks;
+    ocontflag = contflag;
+    oloops = loops;
     if (trap_state == TRAP_STATE_PRIMED)
 	trap_return--;
     oldlastval = lastval;
@@ -4814,6 +4816,17 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
 	opts[XTRACE] = saveopts[XTRACE];
 	opts[PRINTEXITVALUE] = saveopts[PRINTEXITVALUE];
 	opts[LOCALOPTIONS] = saveopts[LOCALOPTIONS];
+	opts[LOCALLOOPS] = saveopts[LOCALLOOPS];
+    }
+
+    if (opts[LOCALLOOPS]) {
+	if (contflag)
+	    zwarn("`continue' active at end of function scope");
+	if (breaks)
+	    zwarn("`break' active at end of function scope");
+	breaks = obreaks;
+	contflag = ocontflag;
+	loops = oloops;
     }
 
     endtrapscope();