mirror of https://github.com/sveltejs/svelte
Merge 348844d758 into 44a7813730
commit
8ddc9d771c
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
perf: O(1) membership in `{@const}` topological sort (`sort_const_tags`)
|
||||
@ -0,0 +1,13 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
// sum is declared before left/right; sort_const_tags must emit deps first.
|
||||
// Also exercises multi-parent membership (sum → left and sum → right).
|
||||
export default test({
|
||||
html: '<p>23</p>',
|
||||
|
||||
async test({ component, target, assert }) {
|
||||
component.n = 1;
|
||||
|
||||
assert.htmlEqual(target.innerHTML, '<p>5</p>');
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
export let n = 10;
|
||||
</script>
|
||||
|
||||
{#if true}
|
||||
{@const sum = left + right}
|
||||
{@const left = n + 1}
|
||||
{@const right = n + 2}
|
||||
<p>{sum}</p>
|
||||
{/if}
|
||||
Loading…
Reference in new issue