Skip to content

Commit 050db34

Browse files
committed
simplify
1 parent 943b810 commit 050db34

File tree

1 file changed

+5
-6
lines changed
  • packages/svelte/src/compiler/migrate

1 file changed

+5
-6
lines changed

packages/svelte/src/compiler/migrate/index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ export function migrate(source, { filename } = {}) {
9393
createBubbler: analysis.root.unique('createBubbler').name,
9494
bubble: analysis.root.unique('bubble').name,
9595
passive: analysis.root.unique('passive').name,
96-
nonpassive: analysis.root.unique('nonpassive').name,
97-
svelte_self: analysis.name
96+
nonpassive: analysis.root.unique('nonpassive').name
9897
},
9998
legacy_imports: new Set(),
10099
script_insertions: new Set(),
@@ -138,7 +137,7 @@ export function migrate(source, { filename } = {}) {
138137
const file = filename.split('/').pop();
139138
str.appendRight(
140139
insertion_point,
141-
`\n${indent}import ${state.names.svelte_self} from './${file}';`
140+
`\n${indent}import ${state.analysis.name} from './${file}';`
142141
);
143142
}
144143

@@ -760,22 +759,22 @@ const template = {
760759
state.str.overwrite(
761760
node.start + 1,
762761
node.start + 1 + 'svelte:self'.length,
763-
`${state.names.svelte_self}`
762+
`${state.analysis.name}`
764763
);
765764
// if it has a fragment we need to overwrite the closing tag too
766765
if (node.fragment.nodes.length > 0) {
767766
state.str.overwrite(
768767
state.str.original.lastIndexOf('<', node.end) + 2,
769768
node.end - 1,
770-
`${state.names.svelte_self}`
769+
`${state.analysis.name}`
771770
);
772771
} else if (!source.endsWith('/>')) {
773772
// special case for case `<svelte:self></svelte:self>` it has no fragment but
774773
// we still need to overwrite the end tag
775774
state.str.overwrite(
776775
node.start + source.lastIndexOf('</', node.end) + 2,
777776
node.end - 1,
778-
`${state.names.svelte_self}`
777+
`${state.analysis.name}`
779778
);
780779
}
781780
state.has_svelte_self = true;

0 commit comments

Comments
 (0)