(
node: Undone<T>,
isGenerator: boolean,
isAsync: boolean,
isConstructor: boolean,
allowDirectSuper: boolean,
type: T["type"],
inClassScope: boolean = false,
)
| 252 | |
| 253 | // @ts-expect-error plugin may override interfaces |
| 254 | parseMethod< |
| 255 | T extends N.ClassPrivateMethod | N.ObjectMethod | N.ClassMethod, |
| 256 | >( |
| 257 | node: Undone<T>, |
| 258 | isGenerator: boolean, |
| 259 | isAsync: boolean, |
| 260 | isConstructor: boolean, |
| 261 | allowDirectSuper: boolean, |
| 262 | type: T["type"], |
| 263 | inClassScope: boolean = false, |
| 264 | ): |
| 265 | | N.EstreeProperty |
| 266 | | N.EstreeMethodDefinition |
| 267 | | N.EstreeTSAbstractMethodDefinition { |
| 268 | let funcNode = this.startNode<N.MethodLike>(); |
| 269 | funcNode.kind = node.kind; // provide kind, so super method correctly sets state |
| 270 | funcNode = super.parseMethod( |
| 271 | // @ts-expect-error estree plugin change node types |
| 272 | funcNode, |
| 273 | isGenerator, |
| 274 | isAsync, |
| 275 | isConstructor, |
| 276 | allowDirectSuper, |
| 277 | type, |
| 278 | inClassScope, |
| 279 | ); |
| 280 | // @ts-expect-error delete non-optional properties |
| 281 | delete funcNode.kind; |
| 282 | const { typeParameters } = node; |
| 283 | if (typeParameters) { |
| 284 | delete node.typeParameters; |
| 285 | funcNode.typeParameters = typeParameters; |
| 286 | this.resetStartLocationFromNode(funcNode, typeParameters); |
| 287 | } |
| 288 | const valueNode = this.castNodeTo( |
| 289 | funcNode as N.MethodLike, |
| 290 | // @ts-expect-error test if body in funcNode and cast to different node types |
| 291 | this.hasPlugin("typescript") && !funcNode.body |
| 292 | ? "TSEmptyBodyFunctionExpression" |
| 293 | : "FunctionExpression", |
| 294 | ); |
| 295 | ( |
| 296 | node as unknown as Undone< |
| 297 | | N.EstreeProperty |
| 298 | | N.EstreeMethodDefinition |
| 299 | | N.EstreeTSAbstractMethodDefinition |
| 300 | > |
| 301 | ).value = valueNode; |
| 302 | if (type === "ClassPrivateMethod") { |
| 303 | node.computed = false; |
| 304 | } |
| 305 | if (this.hasPlugin("typescript")) { |
| 306 | // @ts-expect-error todo(flow->ts) property not defined for all types in union |
| 307 | if (node.abstract) { |
| 308 | // @ts-expect-error remove abstract from TSAbstractMethodDefinition |
| 309 | delete node.abstract; |
| 310 | return this.finishNode( |
| 311 | // @ts-expect-error cast methods to estree types |
no test coverage detected