let statements _within_ match patterns now need parens. adding sections to palette options. etc.
This commit is contained in:
parent
68f4fbe9b3
commit
6ab98c1448
5 changed files with 53 additions and 37 deletions
|
|
@ -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(')(');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue