Sets the content for a source
(sourceIndex SourceIndex, content string)
| 99 | |
| 100 | // Sets the content for a source |
| 101 | func (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 |
| 113 | func (gen *Generator) AddName(name string) NameIndex { |