|
|
@ -57,7 +57,7 @@ export function ClassBody(node, context) {
|
|
|
|
e.state_field_duplicate(node, name);
|
|
|
|
e.state_field_duplicate(node, name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const _key = (key.type === 'PrivateIdentifier' ? '#' : '') + name;
|
|
|
|
const _key = (node.type === 'AssignmentExpression' || !node.static ? '' : '@') + name;
|
|
|
|
const field = fields.get(_key);
|
|
|
|
const field = fields.get(_key);
|
|
|
|
|
|
|
|
|
|
|
|
// if there's already a method or assigned field, error
|
|
|
|
// if there's already a method or assigned field, error
|
|
|
@ -78,7 +78,7 @@ export function ClassBody(node, context) {
|
|
|
|
for (const child of node.body) {
|
|
|
|
for (const child of node.body) {
|
|
|
|
if (child.type === 'PropertyDefinition' && !child.computed && !child.static) {
|
|
|
|
if (child.type === 'PropertyDefinition' && !child.computed && !child.static) {
|
|
|
|
handle(child, child.key, child.value);
|
|
|
|
handle(child, child.key, child.value);
|
|
|
|
const key = (child.key.type === 'PrivateIdentifier' ? '#' : '') + get_name(child.key);
|
|
|
|
const key = /** @type {string} */ (get_name(child.key));
|
|
|
|
const field = fields.get(key);
|
|
|
|
const field = fields.get(key);
|
|
|
|
if (!field) {
|
|
|
|
if (!field) {
|
|
|
|
fields.set(key, [child.value ? 'assigned_prop' : 'prop']);
|
|
|
|
fields.set(key, [child.value ? 'assigned_prop' : 'prop']);
|
|
|
@ -91,7 +91,7 @@ export function ClassBody(node, context) {
|
|
|
|
if (child.kind === 'constructor') {
|
|
|
|
if (child.kind === 'constructor') {
|
|
|
|
constructor = child;
|
|
|
|
constructor = child;
|
|
|
|
} else if (!child.computed) {
|
|
|
|
} else if (!child.computed) {
|
|
|
|
const key = (child.key.type === 'PrivateIdentifier' ? '#' : '') + get_name(child.key);
|
|
|
|
const key = (child.static ? '@' : '') + get_name(child.key);
|
|
|
|
const field = fields.get(key);
|
|
|
|
const field = fields.get(key);
|
|
|
|
if (!field) {
|
|
|
|
if (!field) {
|
|
|
|
fields.set(key, [child.kind]);
|
|
|
|
fields.set(key, [child.kind]);
|
|
|
|