| 82 | } |
| 83 | |
| 84 | public setSources(sourcesJson, mainFunc: Source): void { |
| 85 | if (sourcesJson) { |
| 86 | for (const [sourceId, source] of Object.entries<Source>(sourcesJson)) { |
| 87 | const src = new Source(source.sourceName, source.functionName, source.sourceText, |
| 88 | source.sourceId, source.backwardsCompatibility, source.startPosition, source.endPosition); |
| 89 | this.sources[sourceId] = src; |
| 90 | } |
| 91 | } |
| 92 | // This is a fallback if the JSON is incomplete (e.g. due to compiler crash). |
| 93 | if (!this.sources[-1]) { |
| 94 | this.sources[-1] = mainFunc; |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | public setBytecodeSources(bytecodeSourcesJson): void { |
| 99 | if (!bytecodeSourcesJson) return; |