aboutsummaryrefslogtreecommitdiff
path: root/src/c.bqn
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-08-17 14:25:49 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-08-17 14:25:49 -0400
commitc2d63aff3fab48acca2d865cb6ba4f23c377812c (patch)
tree245222e3df6a546e08a42d742415386e98ba4c7e /src/c.bqn
parent9987a58408580bc78d536c71279b91fc851965e8 (diff)
Catch errors in bodies that should fail on 𝕨 instead of skipping them
Diffstat (limited to 'src/c.bqn')
-rw-r--r--src/c.bqn3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/c.bqn b/src/c.bqn
index 88ebc510..542aca5d 100644
--- a/src/c.bqn
+++ b/src/c.bqn
@@ -239,7 +239,8 @@ Parse ← {r‿vn‿i‿e‿def←𝕨⋄nv←≠vn
nf←H ac<xv=vi-˜⊑bG # Namespace bodies
fw←H gi⊏nx # Bodies where 𝕨 must be defined
{"Can't return Nothing (·)"_err_(𝕩⊏⍋∘Rev) 2=fw⌈↩nf¬⊸×𝕩⊏nr} 1-˜0∾cc⊏rev
- "Invalid use of 𝕨 in monadic case"_err_(/CB) 1↓fw∧cw=0
+ fv←fw⋄fw≥○I1T↩cf # If a body fails on 𝕨, later ones won't see 𝕨
+ (∨´(1↓fv)⊸<)◶"Invalid use of 𝕨 in monadic case"‿"Unreachable body"_err_(/CB) 1↓fw∧cw=0
cw⌈↩2×fw
nn←fo+`⊸⊏2=cw⋄no(⊣-=)↩nn⋄ne(⊣-=)↩nn # 2=cw indicates 𝕨 is never Nothing
"Assignment target must be a name or list of targets"_err_(G) (a∨aid∨ps∨𝕩(=⟜(3+⊑)<M)bB)<aa