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

Function registerFunctionStatementId

packages/babel-parser/src/parser/statement.ts:1584–1600  ·  view source on GitHub ↗
(node: N.NormalFunction)

Source from the content-addressed store, hash-verified

1582 }
1583
1584 registerFunctionStatementId(node: N.NormalFunction): void {
1585 if (!node.id) return;
1586
1587 // If it is a regular function declaration in sloppy mode, then it is
1588 // subject to Annex B semantics (BindingFlag.TYPE_FUNCTION). Otherwise, the binding
1589 // mode depends on properties of the current scope (see
1590 // treatFunctionsAsVar).
1591 this.scope.declareName(
1592 node.id.name,
1593 !this.options.annexB || this.state.strict || node.generator || node.async
1594 ? this.scope.treatFunctionsAsVar
1595 ? BindingFlag.TYPE_VAR
1596 : BindingFlag.TYPE_LEXICAL
1597 : BindingFlag.TYPE_FUNCTION,
1598 node.id.start!,
1599 );
1600 }
1601
1602 // Parse a class declaration or literal (depending on the
1603 // `isStatement` parameter).

Callers

nothing calls this directly

Calls 1

declareNameMethod · 0.45

Tested by

no test coverage detected