Skip to content

Commit 86fdfe0

Browse files
committed
Revert "put path on analysis.elements instead of metadata"
This reverts commit c0c7ab8.
1 parent c0c7ab8 commit 86fdfe0

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

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

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

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

Lines changed: 2 additions & 3 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, path } of analysis.elements) {
727+
outer: for (const { node } of analysis.elements) {
728728
if (node.type === 'RenderTag') continue;
729729

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

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

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

2323
check_element(node, context);
2424

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

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

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

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

0 commit comments

Comments
 (0)