]> ocean-lang.org Git - ocean/commitdiff
oceani: CloseParallel must mark anything not Pending as OutScope
authorNeilBrown <neil@brown.name>
Mon, 8 Nov 2021 09:46:44 +0000 (20:46 +1100)
committerNeilBrown <neil@brown.name>
Mon, 8 Nov 2021 09:56:36 +0000 (20:56 +1100)
Testing doesn't trip on this yet, but will in a future patch.

Signed-off-by: NeilBrown <neil@brown.name>
csrc/oceani-tests.mdc
csrc/oceani.mdc

index fc9f0bd8cbefd97ce14d9a331be67241d66c8e2d..776c1a67dddc990ff67c8e1405b41db34c2ed0b2 100644 (file)
@@ -193,7 +193,7 @@ Test merging of variables from multiple cases
                for i:=0; then i=i+1; while i < 5:
                        switch i:
                                case 0: num:="zero"
-                               case 1: num:="one"
+                               case 1: scratch:=42; num:="one"
                                case 2: num:="two"
                                case 3: num:="three"
                                else    num:="many"
index 7e1f2ac788117dddae2f9e2529e3d34ec8389aac..215a9a709bca6b4ebe568a0b6a1e3ca2e5e252d5 100644 (file)
@@ -1176,9 +1176,11 @@ all pending-scope variables become conditionally scoped.
                                                 v->previous->scope == PendingScope)
                                                /* all previous branches used name */
                                                v->scope = PendingScope;
-                                       else if (v->type == Tlabel)     // UNTESTED
+                                       else if (v->type == Tlabel)
                                                /* Labels remain pending even when not used */
                                                v->scope = PendingScope;        // UNTESTED
+                                       else
+                                               v->scope = OutScope;
                                        if (ct == CloseElse) {
                                                /* All Pending variables with this name
                                                 * are now Conditional */