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

Function parseImportSpecifier

packages/babel-parser/src/parser/statement.ts:3349–3365  ·  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

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