From b2e13559087ae2700266848ea246d71a888ecf01 Mon Sep 17 00:00:00 2001 From: John Chesley Date: Wed, 24 Apr 2019 00:19:48 -0400 Subject: [PATCH 1/2] failing test for #2542 --- .../samples/export-function-hoisting/_config.js | 3 +++ .../samples/export-function-hoisting/main.svelte | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 test/runtime/samples/export-function-hoisting/_config.js create mode 100644 test/runtime/samples/export-function-hoisting/main.svelte diff --git a/test/runtime/samples/export-function-hoisting/_config.js b/test/runtime/samples/export-function-hoisting/_config.js new file mode 100644 index 0000000000..c56851d065 --- /dev/null +++ b/test/runtime/samples/export-function-hoisting/_config.js @@ -0,0 +1,3 @@ +export default { + html: 'Compile plz' +} diff --git a/test/runtime/samples/export-function-hoisting/main.svelte b/test/runtime/samples/export-function-hoisting/main.svelte new file mode 100644 index 0000000000..4b54049ed9 --- /dev/null +++ b/test/runtime/samples/export-function-hoisting/main.svelte @@ -0,0 +1,11 @@ + + +Compile plz From 73aca457d3b720901e8c43945d12a13cf60e64fe Mon Sep 17 00:00:00 2001 From: John Chesley Date: Wed, 24 Apr 2019 00:38:02 -0400 Subject: [PATCH 2/2] fix cycle check for exported functions --- src/compile/Component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compile/Component.ts b/src/compile/Component.ts index bf2fdf9a5a..7d4aa72f03 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -1002,9 +1002,11 @@ export default class Component { if (walking.has(other_declaration)) { hoistable = false; + } else if (other_declaration.type === 'ExportNamedDeclaration' && walking.has(other_declaration.declaration)) { + hoistable = false; } else if (!is_hoistable(other_declaration)) { hoistable = false; - } + } } else {