(node: Undone<N.ImportDeclaration>)
| 3315 | } |
| 3316 | |
| 3317 | parseNamedImportSpecifiers(node: Undone<N.ImportDeclaration>) { |
| 3318 | let first = true; |
| 3319 | this.expect(tt.braceL); |
| 3320 | while (!this.eat(tt.braceR)) { |
| 3321 | if (first) { |
| 3322 | first = false; |
| 3323 | } else { |
| 3324 | // Detect an attempt to deep destructure |
| 3325 | if (this.eat(tt.colon)) { |
| 3326 | throw this.raise(Errors.DestructureNamedImport, this.state.startLoc); |
| 3327 | } |
| 3328 | |
| 3329 | this.expect(tt.comma); |
| 3330 | if (this.eat(tt.braceR)) break; |
| 3331 | } |
| 3332 | |
| 3333 | const specifier = this.startNode<N.ImportSpecifier>(); |
| 3334 | const importedIsString = this.match(tt.string); |
| 3335 | const isMaybeTypeOnly = this.isContextual(tt._type); |
| 3336 | specifier.imported = this.parseModuleExportName(); |
| 3337 | const importSpecifier = this.parseImportSpecifier( |
| 3338 | specifier, |
| 3339 | importedIsString, |
| 3340 | node.importKind === "type" || node.importKind === "typeof", |
| 3341 | isMaybeTypeOnly, |
| 3342 | ); |
| 3343 | node.specifiers.push(importSpecifier); |
| 3344 | } |
| 3345 | } |
| 3346 | |
| 3347 | // https://tc39.es/ecma262/#prod-ImportSpecifier |
| 3348 | // The specifier is validated later by checkImportSpecifier. |
nothing calls this directly
no test coverage detected