let statements _within_ match patterns now need parens. adding sections to palette options. etc.

This commit is contained in:
Dustin Swan 2026-02-13 12:15:56 -07:00
parent 68f4fbe9b3
commit 6ab98c1448
No known key found for this signature in database
GPG key ID: 30D46587E2100467
5 changed files with 53 additions and 37 deletions

View file

@ -38,9 +38,7 @@ export function compile(ast: AST, useStore = true, bound = new Set<string>(), to
if (ast.func.kind === 'constructor') {
const ctorName = ast.func.name;
const arg = compile(ast.args[0], useStore, bound, topLevel);
return `((_a) => _a && typeof _a === 'object' && !Array.isArray(_a) && !_a._tag
? { _tag: "${ctorName}", ..._a }
: { _tag: "${ctorName}", _0: _a })(${arg})`;
return `({ _tag: "${ctorName}", _0: ${arg} })`;
}
const args = ast.args.map(a => compile(a, useStore, bound, topLevel)).join(')(');