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

Function parseImportSpecifier

packages/babel-parser/src/parser/statement.ts:3353–3369  ·  view source on GitHub ↗
(
    specifier: Undone<N.ImportSpecifier>,
    /* eslint-disable @typescript-eslint/no-unused-vars -- used in TypeScript and Flow parser */
    importedIsString: boolean,
    isInTypeOnlyImport: boolean,
    isMaybeTypeOnly: boolean,
    /* eslint-enable @typescript-eslint/no-unused-vars */
  )

Source from the content-addressed store, hash-verified

3351 // https://tc39.es/ecma262/#prod-ImportSpecifier
3352 // The specifier is validated later by checkImportSpecifier.
3353 parseImportSpecifier(
3354 specifier: Undone<N.ImportSpecifier>,
3355 /* eslint-disable @typescript-eslint/no-unused-vars -- used in TypeScript and Flow parser */
3356 importedIsString: boolean,
3357 isInTypeOnlyImport: boolean,
3358 isMaybeTypeOnly: boolean,
3359 /* eslint-enable @typescript-eslint/no-unused-vars */
3360 ): N.ImportSpecifier {
3361 if (this.eatContextual(tt._as)) {
3362 specifier.local = this.parseIdentifier();
3363 } else {
3364 specifier.local ??= this.cloneIdentifier(
3365 specifier.imported as N.Identifier,
3366 );
3367 }
3368 return this.finishNode(specifier, "ImportSpecifier");
3369 }
3370
3371 checkImportSpecifier(
3372 specifier: N.ImportSpecifier,

Callers

nothing calls this directly

Calls 3

parseIdentifierMethod · 0.80
finishNodeMethod · 0.80
cloneIdentifierMethod · 0.45

Tested by

no test coverage detected