originalSourceLines returns the split content of the given source index.
(srcIndex int)
| 188 | |
| 189 | // originalSourceLines returns the split content of the given source index. |
| 190 | func (sm *sourceMap) originalSourceLines(srcIndex int) ([]string, bool) { |
| 191 | if srcIndex < 0 || srcIndex >= len(sm.SourcesContent) { |
| 192 | return nil, false |
| 193 | } |
| 194 | content := sm.SourcesContent[srcIndex] |
| 195 | if content == "" { |
| 196 | return nil, false |
| 197 | } |
| 198 | if sm.origLineCache == nil { |
| 199 | sm.origLineCache = map[int][]string{} |
| 200 | } |
| 201 | if cached, ok := sm.origLineCache[srcIndex]; ok { |
| 202 | return cached, true |
| 203 | } |
| 204 | lines := strings.Split(content, "\n") |
| 205 | sm.origLineCache[srcIndex] = lines |
| 206 | return lines, true |
| 207 | } |
| 208 | |
| 209 | // sourceName returns a display name for a resolved source index. |
| 210 | func (sm *sourceMap) sourceName(srcIndex int) string { |
no outgoing calls