-
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: take other snippets into account when checking for hoistability (#…
- Loading branch information
1 parent
2f46701
commit 9b44c6d
Showing
5 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/svelte2tsx/test/svelte2tsx/samples/snippet-module-hoist-4.v5/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
///<reference types="svelte" /> | ||
; | ||
|
||
;; const hoistable/*Ωignore_positionΩ*/ = ()/*Ωignore_startΩ*/: ReturnType<import('svelte').Snippet>/*Ωignore_endΩ*/ => { async ()/*Ωignore_positionΩ*/ => { | ||
{ svelteHTML.createElement("h1", {}); } | ||
};return __sveltets_2_any(0)};function render() { | ||
const chain/*Ωignore_positionΩ*/ = ()/*Ωignore_startΩ*/: ReturnType<import('svelte').Snippet>/*Ωignore_endΩ*/ => { async ()/*Ωignore_positionΩ*/ => { | ||
{ svelteHTML.createElement("div", {});foo; } | ||
};return __sveltets_2_any(0)}; const chain2/*Ωignore_positionΩ*/ = ()/*Ωignore_startΩ*/: ReturnType<import('svelte').Snippet>/*Ωignore_endΩ*/ => { async ()/*Ωignore_positionΩ*/ => { | ||
;__sveltets_2_ensureSnippet(chain()); | ||
};return __sveltets_2_any(0)}; const chain3/*Ωignore_positionΩ*/ = ()/*Ωignore_startΩ*/: ReturnType<import('svelte').Snippet>/*Ωignore_endΩ*/ => { async ()/*Ωignore_positionΩ*/ => { | ||
;__sveltets_2_ensureSnippet(chain2()); | ||
};return __sveltets_2_any(0)}; | ||
let foo = true; | ||
; | ||
async () => { | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
}; | ||
return { props: /** @type {Record<string, never>} */ ({}), exports: {}, bindings: "", slots: {}, events: {} }} | ||
const Input__SvelteComponent_ = __sveltets_2_isomorphic_component(__sveltets_2_partial(__sveltets_2_with_any_event(render()))); | ||
/*Ωignore_startΩ*/type Input__SvelteComponent_ = InstanceType<typeof Input__SvelteComponent_>; | ||
/*Ωignore_endΩ*/export default Input__SvelteComponent_; |
23 changes: 23 additions & 0 deletions
23
packages/svelte2tsx/test/svelte2tsx/samples/snippet-module-hoist-4.v5/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script module lang="ts"> | ||
</script> | ||
|
||
<script> | ||
let foo = true; | ||
</script> | ||
|
||
{#snippet chain()} | ||
<div>{foo}</div> | ||
{/snippet} | ||
|
||
{#snippet chain2()} | ||
{@render chain()} | ||
{/snippet} | ||
|
||
{#snippet chain3()} | ||
{@render chain2()} | ||
{/snippet} | ||
|
||
{#snippet hoistable()} | ||
<h1>hoist me</h1> | ||
{/snippet} |