Skip to content

Commit f56a3ec

Browse files
committed
remove unnecessary # concatenation
1 parent a3fdd3d commit f56a3ec

File tree

1 file changed

+3
-9
lines changed
  • packages/svelte/src/compiler/phases/2-analyze/visitors

1 file changed

+3
-9
lines changed

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ export function ClassBody(node, context) {
5757
e.state_field_duplicate(node, name);
5858
}
5959

60-
const _key =
61-
(node.type === 'AssignmentExpression' || !node.static ? '' : '@') +
62-
(key.type === 'PrivateIdentifier' ? '#' : '') +
63-
name;
60+
const _key = (node.type === 'AssignmentExpression' || !node.static ? '' : '@') + name;
6461
const field = fields.get(_key);
6562

6663
// if there's already a method or assigned field, error
@@ -81,7 +78,7 @@ export function ClassBody(node, context) {
8178
for (const child of node.body) {
8279
if (child.type === 'PropertyDefinition' && !child.computed && !child.static) {
8380
handle(child, child.key, child.value);
84-
const key = (child.key.type === 'PrivateIdentifier' ? '#' : '') + get_name(child.key);
81+
const key = /** @type {string} */ (get_name(child.key));
8582
const field = fields.get(key);
8683
if (!field) {
8784
fields.set(key, [child.value ? 'assigned_prop' : 'prop']);
@@ -94,10 +91,7 @@ export function ClassBody(node, context) {
9491
if (child.kind === 'constructor') {
9592
constructor = child;
9693
} else if (!child.computed) {
97-
const key =
98-
(child.static ? '@' : '') +
99-
(child.key.type === 'PrivateIdentifier' ? '#' : '') +
100-
get_name(child.key);
94+
const key = (child.static ? '@' : '') + get_name(child.key);
10195
const field = fields.get(key);
10296
if (!field) {
10397
fields.set(key, [child.kind]);

0 commit comments

Comments
 (0)