Skip to content

Commit

Permalink
Merge pull request #2543 from jches/gh/2542
Browse files Browse the repository at this point in the history
Fix is_hoistable cycle
  • Loading branch information
Rich-Harris authored Apr 25, 2019
2 parents ed7c32d + 73aca45 commit f888123
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/compile/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions test/runtime/samples/export-function-hoisting/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
html: 'Compile plz'
}
11 changes: 11 additions & 0 deletions test/runtime/samples/export-function-hoisting/main.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script>
export function one () {
two()
}
export function two () {
return one()
}
</script>

Compile plz

0 comments on commit f888123

Please sign in to comment.