MCPcopy Index your code
hub / github.com/microsoft/typescript-go / parseImportSpecifier

Method parseImportSpecifier

internal/parser/parser.go:2398–2411  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2396}
2397
2398func (p *Parser) parseImportSpecifier() *ast.Node {
2399 pos := p.nodePos()
2400 isTypeOnly, propertyName, name := p.parseImportOrExportSpecifier(ast.KindImportSpecifier)
2401 var identifierName *ast.Node
2402 if name.Kind == ast.KindIdentifier {
2403 identifierName = name
2404 } else {
2405 p.parseErrorAtRange(p.skipRangeTrivia(name.Loc), diagnostics.Identifier_expected)
2406 identifierName = p.newIdentifier("")
2407 p.finishNode(identifierName, name.Pos())
2408 }
2409 result := p.checkJSSyntax(p.finishNode(p.factory.NewImportSpecifier(isTypeOnly, propertyName, identifierName), pos))
2410 return result
2411}
2412
2413func (p *Parser) parseImportOrExportSpecifier(kind ast.Kind) (isTypeOnly bool, propertyName *ast.Node, name *ast.Node) {
2414 // ImportSpecifier:

Callers

nothing calls this directly

Calls 9

nodePosMethod · 0.95
parseErrorAtRangeMethod · 0.95
skipRangeTriviaMethod · 0.95
newIdentifierMethod · 0.95
finishNodeMethod · 0.95
checkJSSyntaxMethod · 0.95
NewImportSpecifierMethod · 0.80
PosMethod · 0.65

Tested by

no test coverage detected