[ts] Support private methods overloads (#13876)
* [parser] Allow private methods overloads when parsing TS * Add transform tests * Fix estree * Fix flow
This commit is contained in:
@@ -2015,7 +2015,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
const bodilessType =
|
||||
type === "FunctionDeclaration"
|
||||
? "TSDeclareFunction"
|
||||
: type === "ClassMethod"
|
||||
: type === "ClassMethod" || type === "ClassPrivateMethod"
|
||||
? "TSDeclareMethod"
|
||||
: undefined;
|
||||
if (bodilessType && !this.match(tt.braceL) && this.isLineTerminator()) {
|
||||
@@ -2755,6 +2755,17 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync);
|
||||
}
|
||||
|
||||
declareClassPrivateMethodInScope(
|
||||
node: N.ClassPrivateMethod | N.EstreeMethodDefinition | N.TSDeclareMethod,
|
||||
kind: number,
|
||||
) {
|
||||
if (node.type === "TSDeclareMethod") return;
|
||||
// This happens when using the "estree" plugin.
|
||||
if (node.type === "MethodDefinition" && !node.value.body) return;
|
||||
|
||||
super.declareClassPrivateMethodInScope(node, kind);
|
||||
}
|
||||
|
||||
parseClassSuper(node: N.Class): void {
|
||||
super.parseClassSuper(node);
|
||||
if (node.superClass && this.isRelational("<")) {
|
||||
|
||||
Reference in New Issue
Block a user