Skip to content

Commit 7eb14e7

Browse files
committed
continue not break
1 parent 289d568 commit 7eb14e7

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ export function analyze_component(root, options) {
432432
}
433433

434434
warn(warnings, binding.node, [], 'non-state-reference', name);
435-
break outer;
435+
continue outer;
436436
}
437437
}
438438
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<script>
22
let a = $state(1);
33
let b = 2;
4+
let c = 3;
45
</script>
56

67
<button onclick={() => a += 1}>a += 1</button>
78
<button onclick={() => b += 1}>b += 1</button>
8-
<p>{a} + {b} = {a + b}</p>
9+
<button onclick={() => c += 1}>c += 1</button>
10+
<p>{a} + {b} + {c} = {a + b + c}</p>

packages/svelte/tests/validator/samples/runes-referenced-nonstate/warnings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,17 @@
1010
"column": 6,
1111
"line": 3
1212
}
13+
},
14+
{
15+
"code": "non-state-reference",
16+
"message": "c is updated, but is not declared with $state(...). Changing its value will not correctly trigger updates.",
17+
"start": {
18+
"column": 5,
19+
"line": 4
20+
},
21+
"end": {
22+
"column": 6,
23+
"line": 4
24+
}
1325
}
1426
]

0 commit comments

Comments
 (0)