From: NeilBrown Date: Sat, 18 Dec 2021 10:07:54 +0000 (+1100) Subject: oceani: handle some more untested code. X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=commitdiff_plain;h=95aa82d18205907d4f4d73f43c1d6bf2a82af288 oceani: handle some more untested code. The mark-untested filter was removing some annotations that are valid... I'm not sure of this 'switch' syntax ... need to think about that one day. Signed-off-by: NeilBrown --- diff --git a/csrc/oceani-tests.mdc b/csrc/oceani-tests.mdc index 45240a2..4e9f4e3 100644 --- a/csrc/oceani-tests.mdc +++ b/csrc/oceani-tests.mdc @@ -221,12 +221,11 @@ Test merging of variables from multiple cases print for i:=0; then i=i+1; while i < 5: - switch i: - case 0: num:="zero" - case 1: num:="one" - case 2: num:="two" - case 3: num:="three" - else num:="many" + switch { use i } + case 0: num:="zero" ; + case 1: num:="one" ; + case 2 { num:="two" } case 3 { num:="three" } + else num:="many" // re-declare a CondScope variable num := i*i print num,", ", diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index ca59924..ad0d1b5 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -4576,7 +4576,7 @@ the common header for all reductions to use. ComplexStatements -> ComplexStatements ComplexStatement ${ if ($2 == NULL) { - $0 = $<1; + $0 = $<1; // NOTEST - impossible } else { $0 = new(binode); $0->op = Block; @@ -4586,7 +4586,7 @@ the common header for all reductions to use. }$ | ComplexStatement ${ if ($1 == NULL) { - $0 = NULL; + $0 = NULL; // NOTEST - impossible } else { $0 = new(binode); $0->op = Block; @@ -5784,7 +5784,7 @@ is a bit more interesting at this level. $0 = declare_function(c, $