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

Method parseResolutionMode

internal/parser/parser.go:6671–6682  ·  view source on GitHub ↗
(mode string, pos int, end int)

Source from the content-addressed store, hash-verified

6669}
6670
6671func (p *Parser) parseResolutionMode(mode string, pos int, end int) (resolutionKind core.ResolutionMode) {
6672 if mode == "import" {
6673 resolutionKind = core.ModuleKindESNext
6674 return resolutionKind
6675 }
6676 if mode == "require" {
6677 resolutionKind = core.ModuleKindCommonJS
6678 return resolutionKind
6679 }
6680 p.parseErrorAt(pos, end, diagnostics.X_resolution_mode_should_be_either_require_or_import)
6681 return resolutionKind
6682}
6683
6684func (p *Parser) jsErrorAtRange(loc core.TextRange, message *diagnostics.Message, args ...any) {
6685 p.jsDiagnostics = append(p.jsDiagnostics, ast.NewDiagnostic(nil, core.NewTextRange(scanner.SkipTrivia(p.sourceText, loc.Pos()), loc.End()), message, args...))

Callers 1

Calls 1

parseErrorAtMethod · 0.95

Tested by

no test coverage detected