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

Function parseMethod

packages/babel-parser/src/parser/expression.ts:2363–2388  ·  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

2361 // Parse object or class method.
2362
2363 parseMethod<T extends N.ObjectMethod | N.ClassMethod | N.ClassPrivateMethod>(
2364 this: Parser,
2365 node: Undone<T>,
2366 isGenerator: boolean,
2367 isAsync: boolean,
2368 isConstructor: boolean,
2369 allowDirectSuper: boolean,
2370 type: T["type"],
2371 inClassScope: boolean = false,
2372 ): T {
2373 this.initFunction(node, isAsync);
2374 node.generator = isGenerator;
2375 this.scope.enter(
2376 ScopeFlag.FUNCTION |
2377 ScopeFlag.SUPER |
2378 (inClassScope ? ScopeFlag.CLASS : 0) |
2379 (allowDirectSuper ? ScopeFlag.DIRECT_SUPER : 0),
2380 );
2381 this.prodParam.enter(functionFlags(isAsync, node.generator));
2382 this.parseFunctionParams(node, isConstructor);
2383 const finishedNode = this.parseFunctionBodyAndFinish(node, type, true);
2384 this.prodParam.exit();
2385 this.scope.exit();
2386
2387 return finishedNode;
2388 }
2389
2390 // parse an array literal
2391 // 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