Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/preprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const preprocess = text => {
node.attributes.forEach(node => node.type === 'Let' && find_contextual_names(compiler, node.expression || node.name));
}
if (Array.isArray(node.children)) {
node.children.forEach(node => node.type === 'ConstTag' && find_contextual_names(compiler, node.expression.left.name));
node.children.forEach(node => node.type === 'ConstTag' && find_contextual_names(compiler, node.expression.left.name || node.expression.left));
}
if (contextual_names.length) {
nodes_with_contextual_scope.add(node);
Expand Down
8 changes: 8 additions & 0 deletions test/samples/const-tag/Input.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script>
export let boxes;
let p;
let dimensions = [{ width: 100, height: 20 }];
</script>

{#each boxes as box}
Expand All @@ -10,6 +11,13 @@

{area} <!-- undef -->

{#each dimensions as dimension}
{@const { width, height } = dimension}
{width}
{height}
{unknown} <!-- undef -->
{/each}

{#await p}
wait
{:then}
Expand Down
11 changes: 9 additions & 2 deletions test/samples/const-tag/expected.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
[
{
"ruleId": "no-undef",
"line": 11,
"line": 12,
"column": 2,
"endLine": 11,
"endLine": 12,
"endColumn": 6
},
{
"ruleId": "no-undef",
"line": 18,
"column": 3,
"endLine": 18,
"endColumn": 10
}
]