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

Function checkImportSpecifier

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

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

Callers

nothing calls this directly

Calls 1

checkReservedWordMethod · 0.45

Tested by

no test coverage detected