Set initialised per declarator

pull/2624/head
Paul Sherman 7 years ago
parent 60e73c41dc
commit 5fdf109ed3

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

@ -0,0 +1,7 @@
<svelte:options tag="my-app"/>
<script>
export let foo = undefined;
</script>
<p>foo: {foo}</p>

@ -0,0 +1,17 @@
import * as assert from 'assert';
import './main.svelte';
export default function (target) {
const warnings = [];
const warn = console.warn;
console.warn = warning => {
warnings.push(warning);
};
target.innerHTML = '<my-app />';
assert.equal(warnings.length, 0);
console.warn = warn;
}
Loading…
Cancel
Save