Extract 'parseClassMember' method (#533)
This commit is contained in:
@@ -59,8 +59,9 @@ export default (superClass: Class<Parser>): Class<Parser> => class extends super
|
||||
}
|
||||
}
|
||||
|
||||
checkGetterSetterParamCount(prop: N.ObjectMethod): void {
|
||||
checkGetterSetterParamCount(prop: N.ObjectMethod | N.ClassMethod): void {
|
||||
const paramCount = prop.kind === "get" ? 0 : 1;
|
||||
// $FlowFixMe (prop.value present for ObjectMethod, but for ClassMethod should use prop.params?)
|
||||
if (prop.value.params.length !== paramCount) {
|
||||
const start = prop.start;
|
||||
if (prop.kind === "get") {
|
||||
|
||||
@@ -1242,7 +1242,7 @@ export default (superClass: Class<Parser>): Class<Parser> => class extends super
|
||||
return this.match(tt.colon) || super.isClassProperty();
|
||||
}
|
||||
|
||||
isNonstaticConstructor(method: N.ClassMethod): boolean {
|
||||
isNonstaticConstructor(method: N.ClassMethod | N.ClassProperty): boolean {
|
||||
return !this.match(tt.colon) && super.isNonstaticConstructor(method);
|
||||
}
|
||||
|
||||
@@ -1281,9 +1281,10 @@ export default (superClass: Class<Parser>): Class<Parser> => class extends super
|
||||
}
|
||||
}
|
||||
|
||||
parsePropertyName(node: N.ObjectMember): N.Identifier {
|
||||
parsePropertyName(node: N.ObjectOrClassMember): N.Identifier {
|
||||
const variance = this.flowParseVariance();
|
||||
const key = super.parsePropertyName(node);
|
||||
// $FlowFixMe (variance not defined on ClassPrivateProperty)
|
||||
node.variance = variance;
|
||||
return key;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user