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

Method SetSourceContent

internal/sourcemap/generator.go:101–110  ·  view source on GitHub ↗

Sets the content for a source

(sourceIndex SourceIndex, content string)

Source from the content-addressed store, hash-verified

99
100// Sets the content for a source
101func (gen *Generator) SetSourceContent(sourceIndex SourceIndex, content string) error {
102 if sourceIndex < 0 || int(sourceIndex) >= len(gen.sources) {
103 return errors.New("sourceIndex is out of range")
104 }
105 for len(gen.sourcesContent) <= int(sourceIndex) {
106 gen.sourcesContent = append(gen.sourcesContent, nil)
107 }
108 gen.sourcesContent[sourceIndex] = &content
109 return nil
110}
111
112// Declares a name in the source map, returning the index of the name
113func (gen *Generator) AddName(name string) NameIndex {

Calls 4

lenFunction · 0.85
NewMethod · 0.80
intInterface · 0.50
appendFunction · 0.50