Skip to content

Commit 90e35a3

Browse files
damianpumartaylorzane
authored andcommitted
fix compiler hanging on <slot slot="..."> (sveltejs#5536)
1 parent 9088f60 commit 90e35a3

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

src/compiler/compile/render_dom/wrappers/shared/create_debugging_comment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function create_debugging_comment(
2929
} else {
3030
// @ts-ignore
3131
d = node.expression ? node.expression.node.end : c;
32-
while (source[d] !== '}') d += 1;
32+
while (source[d] !== '}' && d <= source.length) d += 1;
3333
while (source[d] === '}') d += 1;
3434
}
3535

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div>
2+
<slot name="test" />
3+
</div>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script>
2+
import Component from './Component.svelte';
3+
</script>
4+
5+
<Component>
6+
<slot slot="test" />
7+
</Component>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
html: '<div><span>lol</span></div>'
3+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
import Forward from './Forward.svelte';
3+
</script>
4+
5+
<Forward>
6+
<span>
7+
lol
8+
</span>
9+
</Forward>

0 commit comments

Comments
 (0)