mirror of https://github.com/sveltejs/svelte
fix: better migration for leading and trailing comments (#13630)
parent
f579a3ba7d
commit
440017d442
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: better migration for leading and trailing comments
|
@ -0,0 +1,27 @@
|
||||
<script>
|
||||
let count = 0;
|
||||
|
||||
$: {
|
||||
console.log({ count, double });
|
||||
}
|
||||
|
||||
// this comment should remain attached to this declaration after migration
|
||||
$: double = count * 2; // this too
|
||||
|
||||
// triple
|
||||
let triple;
|
||||
$: {
|
||||
// update triple
|
||||
triple = count * 3;
|
||||
// trailing comment
|
||||
// in triple
|
||||
}
|
||||
|
||||
function increment() {
|
||||
count += 1;
|
||||
}
|
||||
</script>
|
||||
|
||||
<button onclick={increment}>
|
||||
clicks: {count}
|
||||
</button>
|
@ -0,0 +1,27 @@
|
||||
<script>
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
let count = $state(0);
|
||||
|
||||
|
||||
|
||||
// triple
|
||||
// update triple
|
||||
let triple = $derived(count * 3)
|
||||
// trailing comment
|
||||
// in triple;
|
||||
|
||||
function increment() {
|
||||
count += 1;
|
||||
}
|
||||
// this comment should remain attached to this declaration after migration
|
||||
let double = $derived(count * 2); // this too
|
||||
run(() => {
|
||||
console.log({ count, double });
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<button onclick={increment}>
|
||||
clicks: {count}
|
||||
</button>
|
Loading…
Reference in new issue