Skip to content

Commit c0c7ab8

Browse files
committed
put path on analysis.elements instead of metadata
1 parent 8f02f1e commit c0c7ab8

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

packages/svelte/src/compiler/phases/1-parse/state/element.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ export default function element(parser) {
151151
svg: false,
152152
mathml: false,
153153
scoped: false,
154-
has_spread: false,
155-
path: []
154+
has_spread: false
156155
},
157156
parent: null
158157
}

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ export function analyze_component(root, source, options) {
724724
warn_unused(analysis.css.ast);
725725
}
726726

727-
outer: for (const { node } of analysis.elements) {
727+
outer: for (const { node, path } of analysis.elements) {
728728
if (node.type === 'RenderTag') continue;
729729

730730
if (node.metadata.scoped) {
@@ -780,8 +780,9 @@ export function analyze_component(root, source, options) {
780780
}
781781
])
782782
);
783+
783784
if (is_custom_element_node(node) && node.attributes.length === 1) {
784-
mark_subtree_dynamic(node.metadata.path);
785+
mark_subtree_dynamic(path);
785786
}
786787
}
787788
}

packages/svelte/src/compiler/phases/2-analyze/visitors/RegularElement.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ export function RegularElement(node, context) {
2222

2323
check_element(node, context);
2424

25-
node.metadata.path = [...context.path];
26-
27-
context.state.analysis.elements.push({ node, path: context.path });
25+
context.state.analysis.elements.push({ node, path: [...context.path] });
2826

2927
// Special case: Move the children of <textarea> into a value attribute if they are dynamic
3028
if (node.name === 'textarea' && node.fragment.nodes.length > 0) {

packages/svelte/src/compiler/types/template.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ export namespace AST {
303303
/** `true` if contains a SpreadAttribute */
304304
has_spread: boolean;
305305
scoped: boolean;
306-
path: SvelteNode[];
307306
};
308307
}
309308

0 commit comments

Comments
 (0)