mirror of https://github.com/sveltejs/svelte
parent
6307a3322c
commit
e0af98ba51
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
perf: hoist variables which are not mutated or reassigned
|
@ -0,0 +1,3 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({});
|
@ -0,0 +1,19 @@
|
||||
// index.svelte (Svelte VERSION)
|
||||
// Note: compiler output will change before 5.0 is released!
|
||||
import "svelte/internal/disclose-version";
|
||||
import * as $ from "svelte/internal";
|
||||
|
||||
const count = 0;
|
||||
var frag = $.template(`<p> </p>`);
|
||||
|
||||
export default function Hoist_unmodified_var($$anchor, $$props) {
|
||||
$.push($$props, true);
|
||||
|
||||
/* Init */
|
||||
var p = $.open($$anchor, true, frag);
|
||||
var text = $.child(p);
|
||||
|
||||
text.nodeValue = $.stringify(count);
|
||||
$.close($$anchor, p);
|
||||
$.pop();
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
// index.svelte (Svelte VERSION)
|
||||
// Note: compiler output will change before 5.0 is released!
|
||||
import * as $ from "svelte/internal/server";
|
||||
|
||||
export default function Hoist_unmodified_var($$payload, $$props) {
|
||||
$.push(true);
|
||||
|
||||
let count = 0;
|
||||
|
||||
$$payload.out += `<p>${$.escape_text(count)}</p>`;
|
||||
$.pop();
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<svelte:options runes={true} />
|
||||
|
||||
<script>
|
||||
let count = 0;
|
||||
</script>
|
||||
|
||||
<p>{count}</p>
|
Loading…
Reference in new issue