mirror of https://github.com/sveltejs/svelte
parent
a13c946966
commit
caf5fd5e3d
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: improve template literal expression output generation
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({});
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
// index.svelte (Svelte VERSION)
|
||||||
|
// Note: compiler output will change before 5.0 is released!
|
||||||
|
import "svelte/internal/disclose-version";
|
||||||
|
import * as $ from "svelte/internal";
|
||||||
|
|
||||||
|
export default function Each_string_template($$anchor, $$props) {
|
||||||
|
$.push($$props, false);
|
||||||
|
|
||||||
|
/* Init */
|
||||||
|
var fragment = $.comment($$anchor);
|
||||||
|
var node = $.child_frag(fragment);
|
||||||
|
|
||||||
|
$.each_indexed(
|
||||||
|
node,
|
||||||
|
() => ['foo', 'bar', 'baz'],
|
||||||
|
1,
|
||||||
|
($$anchor, thing, $$index) => {
|
||||||
|
/* Init */
|
||||||
|
var node_1 = $.space($$anchor);
|
||||||
|
|
||||||
|
/* Update */
|
||||||
|
$.text_effect(node_1, () => `${$.stringify($.unwrap(thing))}, `);
|
||||||
|
$.close($$anchor, node_1);
|
||||||
|
},
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
$.close_frag($$anchor, fragment);
|
||||||
|
$.pop();
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
// index.svelte (Svelte VERSION)
|
||||||
|
// Note: compiler output will change before 5.0 is released!
|
||||||
|
import * as $ from "svelte/internal/server";
|
||||||
|
|
||||||
|
export default function Each_string_template($$payload, $$props) {
|
||||||
|
$.push(false);
|
||||||
|
|
||||||
|
const anchor = $.create_anchor($$payload);
|
||||||
|
const each_array = $.ensure_array_like(['foo', 'bar', 'baz']);
|
||||||
|
|
||||||
|
$$payload.out += `${anchor}`;
|
||||||
|
|
||||||
|
for (let $$index = 0; $$index < each_array.length; $$index++) {
|
||||||
|
const thing = each_array[$$index];
|
||||||
|
const anchor_1 = $.create_anchor($$payload);
|
||||||
|
|
||||||
|
$$payload.out += `${anchor_1}${$.escape(thing)},${$.escape(' ')}${anchor_1}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
$$payload.out += `${anchor}`;
|
||||||
|
$.pop();
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
{#each ['foo', 'bar', 'baz'] as thing}
|
||||||
|
{thing},{' '}
|
||||||
|
{/each}
|
||||||
Loading…
Reference in new issue