fix: correctly analyze `<object.property>` components (#16711)

* fix: correctly analyze `<object.property>` components

* add test

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
pull/16744/head
ComputerGuy 7 days ago committed by GitHub
parent f09f25e6a3
commit 2743cd0fe5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: correctly analyze `<object.property>` components

@ -1032,7 +1032,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
},
Component: (node, context) => {
context.state.scope.reference(b.id(node.name), context.path);
context.state.scope.reference(b.id(node.name.split('.')[0]), context.path);
Component(node, context);
},
SvelteSelf: Component,

@ -0,0 +1,5 @@
import { test } from '../../test';
export default test({
html: '<h1>Hello world!</h1>'
});

@ -0,0 +1,13 @@
<script>
import Component from './Component.svelte';
const object = {
property: Component
};
</script>
{#snippet not_hoisted()}
<object.property />
{/snippet}
{@render not_hoisted()}
Loading…
Cancel
Save