Fix private property parsing in Flow (#8340)
* Fix private property parsing in Flow * Flow tests updated * Fix type error * Appropriate name was given to test folder * Fix * Empty * Correct type annotation * Add required changes in generator package * Add required changes in flow-strip-types
This commit is contained in:
committed by
Nicolò Ribaudo
parent
b8f9ebf638
commit
5c728ea609
@@ -1917,6 +1917,15 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
return super.parseClassProperty(node);
|
||||
}
|
||||
|
||||
parseClassPrivateProperty(
|
||||
node: N.ClassPrivateProperty,
|
||||
): N.ClassPrivateProperty {
|
||||
if (this.match(tt.colon)) {
|
||||
node.typeAnnotation = this.flowParseTypeAnnotation();
|
||||
}
|
||||
return super.parseClassPrivateProperty(node);
|
||||
}
|
||||
|
||||
// determine whether or not we're currently in the position where a class method would appear
|
||||
isClassMethod(): boolean {
|
||||
return this.isRelational("<") || super.isClassMethod();
|
||||
|
||||
@@ -717,6 +717,7 @@ export type ClassPrivateProperty = NodeBase & {
|
||||
value: ?Expression, // TODO: Not in spec that this is nullable.
|
||||
static: boolean,
|
||||
computed: false,
|
||||
typeAnnotation?: ?TypeAnnotation, // TODO: Not in spec
|
||||
};
|
||||
|
||||
export type OptClassDeclaration = ClassBase &
|
||||
|
||||
Reference in New Issue
Block a user