pull/14642/head
Dominic Gannaway 2 years ago
parent b05d42c067
commit bdf3a1aafa

@ -99,8 +99,9 @@ function can_hoist_snippet(scope, scopes, visited = new Set()) {
if (binding.initial?.type === 'SnippetBlock') {
if (visited.has(binding)) continue;
visited.add(binding);
const snippet_scope = /** @type {Scope} */ (scopes.get(binding.initial));
if (can_hoist_snippet(binding.scope, scopes, visited)) {
if (can_hoist_snippet(snippet_scope, scopes, visited)) {
continue;
}
}

@ -15,16 +15,16 @@
"end": 20,
"type": "Action",
"name": "autofocus",
"modifiers": [],
"expression": null
"expression": null,
"modifiers": []
},
{
"start": 21,
"end": 34,
"type": "Action",
"name": "autofocus",
"modifiers": [],
"expression": null
"expression": null,
"modifiers": []
}
],
"children": []

@ -15,7 +15,6 @@
"end": 39,
"type": "Action",
"name": "tooltip",
"modifiers": [],
"expression": {
"type": "CallExpression",
"start": 21,
@ -66,7 +65,8 @@
}
],
"optional": false
}
},
"modifiers": []
}
],
"children": []

@ -15,7 +15,6 @@
"end": 28,
"type": "Action",
"name": "tooltip",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 20,
@ -31,7 +30,8 @@
}
},
"name": "message"
}
},
"modifiers": []
}
],
"children": []

@ -15,7 +15,6 @@
"end": 36,
"type": "Action",
"name": "tooltip",
"modifiers": [],
"expression": {
"type": "Literal",
"start": 21,
@ -32,7 +31,8 @@
},
"value": "tooltip msg",
"raw": "'tooltip msg'"
}
},
"modifiers": []
}
],
"children": []

@ -15,8 +15,8 @@
"end": 20,
"type": "Action",
"name": "autofocus",
"modifiers": [],
"expression": null
"expression": null,
"modifiers": []
}
],
"children": []

@ -20,8 +20,8 @@
"end": 50,
"type": "Animation",
"name": "flip",
"modifiers": [],
"expression": null
"expression": null,
"modifiers": []
}
],
"children": [

@ -15,7 +15,6 @@
"end": 22,
"type": "Class",
"name": "foo",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 16,
@ -31,7 +30,8 @@
}
},
"name": "isFoo"
}
},
"modifiers": []
}
],
"children": []

@ -15,7 +15,6 @@
"end": 23,
"type": "EventHandler",
"name": "click",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 19,
@ -31,7 +30,8 @@
}
},
"name": "foo"
}
},
"modifiers": []
}
],
"children": [

@ -22,13 +22,13 @@
"end": 46,
"type": "Binding",
"name": "foo",
"modifiers": [],
"expression": {
"start": 43,
"end": 46,
"type": "Identifier",
"name": "foo"
}
},
"modifiers": []
}
],
"children": []

@ -22,7 +22,6 @@
"end": 55,
"type": "Binding",
"name": "value",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 50,
@ -38,7 +37,8 @@
}
},
"name": "name"
}
},
"modifiers": []
}
],
"children": []

@ -15,7 +15,6 @@
"end": 45,
"type": "EventHandler",
"name": "click",
"modifiers": [],
"expression": {
"type": "ArrowFunctionExpression",
"start": 19,
@ -100,7 +99,8 @@
}
}
}
}
},
"modifiers": []
}
],
"children": [

@ -22,7 +22,6 @@
"end": 692,
"type": "EventHandler",
"name": "click",
"modifiers": [],
"expression": {
"type": "ArrowFunctionExpression",
"start": 596,
@ -137,7 +136,8 @@
"end": 594
}
]
}
},
"modifiers": []
}
],
"children": [

@ -22,7 +22,6 @@
"end": 53,
"type": "Binding",
"name": "this",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 49,
@ -38,7 +37,8 @@
}
},
"name": "foo"
}
},
"modifiers": []
}
],
"children": []

@ -15,8 +15,8 @@
"end": 12,
"type": "Transition",
"name": "fade",
"modifiers": [],
"expression": null,
"modifiers": [],
"intro": true,
"outro": false
}

@ -15,7 +15,6 @@
"end": 30,
"type": "Transition",
"name": "style",
"modifiers": [],
"expression": {
"type": "ObjectExpression",
"start": 16,
@ -85,6 +84,7 @@
}
]
},
"modifiers": [],
"intro": true,
"outro": false
}

@ -25,7 +25,6 @@
"end": 147,
"type": "OnDirective",
"name": "click",
"modifiers": [],
"expression": {
"type": "ArrowFunctionExpression",
"start": 73,
@ -316,7 +315,8 @@
}
]
}
}
},
"modifiers": []
}
],
"fragment": {

@ -0,0 +1,5 @@
import { test } from '../../test';
export default test({
html: '<h1>Hello world!</h1>'
});

@ -0,0 +1,13 @@
<script module>
export { foo }
</script>
<script>
let name = 'world';
</script>
<h1>Hello {name}!</h1>
{#snippet foo()}
oo
{/snippet}

@ -2,17 +2,17 @@ import "svelte/internal/disclose-version";
import * as $ from "svelte/internal/client";
import TextInput from './Child.svelte';
var root = $.template(`<!> `, 1);
const snippet = ($$anchor) => {
$.next();
export default function Bind_component_snippet($$anchor) {
const snippet = ($$anchor) => {
$.next();
var text = $.text("Something");
var text = $.text("Something");
$.append($$anchor, text);
};
$.append($$anchor, text);
};
var root = $.template(`<!> `, 1);
export default function Bind_component_snippet($$anchor) {
let value = $.state('');
const _snippet = snippet;
var fragment = root();

@ -1,14 +1,13 @@
import * as $ from "svelte/internal/server";
import TextInput from './Child.svelte';
function snippet($$payload) {
$$payload.out += `<!---->Something`;
}
export default function Bind_component_snippet($$payload) {
let value = '';
const _snippet = snippet;
function snippet($$payload) {
$$payload.out += `<!---->Something`;
}
let $$settled = true;
let $$inner_payload;

Loading…
Cancel
Save