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

Method parseImportAttributes

internal/parser/parser.go:3090–3114  ·  view source on GitHub ↗
(token ast.Kind, skipKeyword bool)

Source from the content-addressed store, hash-verified

3088}
3089
3090func (p *Parser) parseImportAttributes(token ast.Kind, skipKeyword bool) *ast.Node {
3091 pos := p.nodePos()
3092 if !skipKeyword {
3093 p.parseExpected(token)
3094 }
3095 var elements *ast.NodeList
3096 var multiLine bool
3097 openBracePosition := p.scanner.TokenStart()
3098 if p.parseExpected(ast.KindOpenBraceToken) {
3099 multiLine = p.hasPrecedingLineBreak()
3100 elements = p.parseDelimitedList(PCImportAttributes, (*Parser).parseImportAttribute)
3101 if !p.parseExpected(ast.KindCloseBraceToken) {
3102 if len(p.diagnostics) != 0 {
3103 lastDiagnostic := p.diagnostics[len(p.diagnostics)-1]
3104 if lastDiagnostic.Code() == diagnostics.X_0_expected.Code() {
3105 related := ast.NewDiagnostic(nil, core.NewTextRange(openBracePosition, openBracePosition), diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
3106 lastDiagnostic.AddRelatedInfo(related)
3107 }
3108 }
3109 }
3110 } else {
3111 elements = p.parseEmptyNodeList()
3112 }
3113 return p.finishNode(p.factory.NewImportAttributes(token, elements, multiLine), pos)
3114}
3115
3116func (p *Parser) parseTypeQuery() *ast.Node {
3117 pos := p.nodePos()

Callers 3

parseImportTypeMethod · 0.95

Calls 13

nodePosMethod · 0.95
parseExpectedMethod · 0.95
hasPrecedingLineBreakMethod · 0.95
parseDelimitedListMethod · 0.95
parseEmptyNodeListMethod · 0.95
finishNodeMethod · 0.95
NewDiagnosticFunction · 0.92
NewTextRangeFunction · 0.92
lenFunction · 0.85
TokenStartMethod · 0.80
AddRelatedInfoMethod · 0.80
NewImportAttributesMethod · 0.80

Tested by

no test coverage detected