Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow destructured defaults to refer to variables #5986

Merged
merged 8 commits into from
Feb 25, 2021
Prev Previous commit
Next Next commit
fix missing semicolon
habibrosyad authored and tanhauhau committed Feb 11, 2021
commit 79f80a7e918d5bcfbcd8d26fdb3e60d532a13e43
4 changes: 2 additions & 2 deletions src/compiler/compile/nodes/shared/Context.ts
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ export function unpack_destructuring(contexts: Context[], node: Node, modifier:

update_reference(contexts.slice(0, n), node, alternate);

return x`${modifier(node)}[${i}] !== undefined ? ${modifier(node)}[${i}] : ${alternate.replacement || alternate}` as Node
return x`${modifier(node)}[${i}] !== undefined ? ${modifier(node)}[${i}] : ${alternate.replacement || alternate}` as Node;
});
} else {
unpack_destructuring(contexts, element, node => x`${modifier(node)}[${i}]` as Node);
@@ -61,7 +61,7 @@ export function unpack_destructuring(contexts: Context[], node: Node, modifier:

update_reference(contexts.slice(0, n), node, alternate);

return x`${modifier(node)}.${key.name} !== undefined ? ${modifier(node)}.${key.name} : ${alternate.replacement || alternate}` as Node
return x`${modifier(node)}.${key.name} !== undefined ? ${modifier(node)}.${key.name} : ${alternate.replacement || alternate}` as Node;
});
} else {
unpack_destructuring(contexts, value, node => x`${modifier(node)}.${key.name}` as Node);