From: NeilBrown Date: Mon, 8 Nov 2021 09:46:44 +0000 (+1100) Subject: oceani: CloseParallel must mark anything not Pending as OutScope X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=commitdiff_plain;h=98e9ff743107bb2ec43acbd6b361cddddcb6f1c0 oceani: CloseParallel must mark anything not Pending as OutScope Testing doesn't trip on this yet, but will in a future patch. Signed-off-by: NeilBrown --- diff --git a/csrc/oceani-tests.mdc b/csrc/oceani-tests.mdc index fc9f0bd..776c1a6 100644 --- a/csrc/oceani-tests.mdc +++ b/csrc/oceani-tests.mdc @@ -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" diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index 7e1f2ac..215a9a7 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -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 */