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

Function registerFunctionStatementId

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

declareNameMethod · 0.45

Tested by

no test coverage detected