Merge pull request #2637 from sveltejs/gh-2635

Fix determining which props need a value in dev mode
pull/2670/head
Rich Harris 5 years ago committed by GitHub
commit 73bf5829f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -75,12 +75,10 @@ export class Scope {
if (node.kind === 'var' && this.block && this.parent) { if (node.kind === 'var' && this.block && this.parent) {
this.parent.add_declaration(node); this.parent.add_declaration(node);
} else if (node.type === 'VariableDeclaration') { } else if (node.type === 'VariableDeclaration') {
const initialised = !!node.init;
node.declarations.forEach((declarator: Node) => { node.declarations.forEach((declarator: Node) => {
extract_names(declarator.id).forEach(name => { extract_names(declarator.id).forEach(name => {
this.declarations.set(name, node); this.declarations.set(name, node);
if (initialised) this.initialised_declarations.add(name); if (declarator.init) this.initialised_declarations.add(name);
}); });
}); });
} else { } else {

@ -1,5 +1,6 @@
<script> <script>
export let value; export let value;
export let value_with_default = undefined;
</script> </script>
<input bind:value> <input bind:value>

@ -1,6 +1,7 @@
<script> <script>
export let x; export let x;
export let y; export let y;
export let z = undefined;
</script> </script>
<div>{x} {y}</div> <div>{x} {y}</div>
Loading…
Cancel
Save