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

Function checkImportSpecifier

packages/babel-parser/src/parser/statement.ts:3367–3384  ·  view source on GitHub ↗
(
    specifier: N.ImportSpecifier,
    /* used in TypeScript and Flow parser */
    isInTypeOnlyImport: boolean,
    bindingType: BindingFlag = BindingFlag.TYPE_LEXICAL,
    checkReservedWord: boolean = true,
  )

Source from the content-addressed store, hash-verified

3365 }
3366
3367 checkImportSpecifier(
3368 specifier: N.ImportSpecifier,
3369 /* used in TypeScript and Flow parser */
3370 isInTypeOnlyImport: boolean,
3371 bindingType: BindingFlag = BindingFlag.TYPE_LEXICAL,
3372 checkReservedWord: boolean = true,
3373 ) {
3374 const { imported, local } = specifier;
3375 if (this.isStringModuleExportName(local)) {
3376 throw this.raise(Errors.ImportBindingIsString, specifier, {
3377 importName: (imported as N.StringLiteral).value,
3378 });
3379 }
3380 if (checkReservedWord && local.start === imported.start) {
3381 this.checkReservedWord(local.name, local.start!, true, true);
3382 }
3383 this.checkLVal(local, { type: "ImportSpecifier" }, bindingType);
3384 }
3385
3386 isStringModuleExportName(
3387 node: N.Identifier | N.StringLiteral,

Callers

nothing calls this directly

Calls 1

checkReservedWordMethod · 0.45

Tested by

no test coverage detected