MCPcopy Create free account
hub / github.com/babel/babel / parseMethod

Function parseMethod

packages/babel-parser/src/parser/expression.ts:2473–2498  ·  view source on GitHub ↗
(
    this: Parser,
    node: Undone<T>,
    isGenerator: boolean,
    isAsync: boolean,
    isConstructor: boolean,
    allowDirectSuper: boolean,
    type: T["type"],
    inClassScope: boolean = false,
  )

Source from the content-addressed store, hash-verified

2471 // Parse object or class method.
2472
2473 parseMethod<T extends N.ObjectMethod | N.ClassMethod | N.ClassPrivateMethod>(
2474 this: Parser,
2475 node: Undone<T>,
2476 isGenerator: boolean,
2477 isAsync: boolean,
2478 isConstructor: boolean,
2479 allowDirectSuper: boolean,
2480 type: T["type"],
2481 inClassScope: boolean = false,
2482 ): T {
2483 this.initFunction(node, isAsync);
2484 node.generator = isGenerator;
2485 this.scope.enter(
2486 ScopeFlag.FUNCTION |
2487 ScopeFlag.SUPER |
2488 (inClassScope ? ScopeFlag.CLASS : 0) |
2489 (allowDirectSuper ? ScopeFlag.DIRECT_SUPER : 0),
2490 );
2491 this.prodParam.enter(functionFlags(isAsync, node.generator));
2492 this.parseFunctionParams(node, isConstructor);
2493 const finishedNode = this.parseFunctionBodyAndFinish(node, type, true);
2494 this.prodParam.exit();
2495 this.scope.exit();
2496
2497 return finishedNode;
2498 }
2499
2500 // parse an array literal
2501 // https://tc39.es/ecma262/#prod-ArrayLiteral

Callers

nothing calls this directly

Calls 6

functionFlagsFunction · 0.90
initFunctionMethod · 0.80
enterMethod · 0.45
parseFunctionParamsMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected