* Set the source content for a source file.
(aSourceFile, aSourceContent)
| 135 | * Set the source content for a source file. |
| 136 | */ |
| 137 | setSourceContent(aSourceFile, aSourceContent) { |
| 138 | let source = aSourceFile; |
| 139 | if (this._sourceRoot != null) { |
| 140 | source = util.relative(this._sourceRoot, source); |
| 141 | } |
| 142 | |
| 143 | if (aSourceContent != null) { |
| 144 | // Add the source content to the _sourcesContents map. |
| 145 | // Create a new _sourcesContents map if the property is null. |
| 146 | if (!this._sourcesContents) { |
| 147 | this._sourcesContents = Object.create(null); |
| 148 | } |
| 149 | this._sourcesContents[util.toSetString(source)] = aSourceContent; |
| 150 | } else if (this._sourcesContents) { |
| 151 | // Remove the source file from the _sourcesContents map. |
| 152 | // If the _sourcesContents map is empty, set the property to null. |
| 153 | delete this._sourcesContents[util.toSetString(source)]; |
| 154 | if (Object.keys(this._sourcesContents).length === 0) { |
| 155 | this._sourcesContents = null; |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * Applies the mappings of a sub-source-map for a specific source file to the |
no outgoing calls
no test coverage detected