From bfb89d64badd6bc3b106a277ceb952d9b60baf8b Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Tue, 7 Dec 2021 07:55:32 -0500 Subject: Fix JS VM's handling of single-body block function with a header --- docs/bqn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/bqn.js') diff --git a/docs/bqn.js b/docs/bqn.js index 1314e40c..bfa87f34 100644 --- a/docs/bqn.js +++ b/docs/bqn.js @@ -134,10 +134,10 @@ let run = (B,O,F,S,L,T,src,env) => { // Bytecode, Objects, Blocks, Bodies, Locat let c,vid,def; if (isnum(ind)) { [c,vid] = gen(ind); + c="do {"+c+"} while (0);\nthrow Error('No matching case');\n"; if (useenv) { c = "const e=env;"+c; env.vid=vid; } else if (imm) c = "const e=[...e2];e.vid=vid;e.p=oe;"+c; else c = "const fn=(x, w)=>{const e=[...e2];e.vid=vid;e.p=oe;e[0]=fn;e[1]=x;e[2]=w;"+c+"};"+repdf[type]+"return fn;"; - c="do {"+c+"} while (0);\nthrow Error('No matching case');\n"; def = useenv ? "env" : ("new Array("+vid.length+").fill(null)"); } else { if (imm !== +(ind.length<2)) throw "Internal error: malformed block info"; -- cgit v1.2.3