Skip to content

Commit 2743cd0

Browse files
fix: correctly analyze <object.property> components (#16711)
* fix: correctly analyze `<object.property>` components * add test --------- Co-authored-by: Rich Harris <[email protected]>
1 parent f09f25e commit 2743cd0

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

.changeset/khaki-flies-remember.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: correctly analyze `<object.property>` components

packages/svelte/src/compiler/phases/scope.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
10321032
},
10331033

10341034
Component: (node, context) => {
1035-
context.state.scope.reference(b.id(node.name), context.path);
1035+
context.state.scope.reference(b.id(node.name.split('.')[0]), context.path);
10361036
Component(node, context);
10371037
},
10381038
SvelteSelf: Component,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>Hello world!</h1>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { test } from '../../test';
2+
3+
export default test({
4+
html: '<h1>Hello world!</h1>'
5+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script>
2+
import Component from './Component.svelte';
3+
4+
const object = {
5+
property: Component
6+
};
7+
</script>
8+
9+
{#snippet not_hoisted()}
10+
<object.property />
11+
{/snippet}
12+
13+
{@render not_hoisted()}

0 commit comments

Comments
 (0)