* Add a single mapping from original source line and column to the generated * source's line and column for this source map being created. The mapping * object should have the following properties: * * - generated: An object with the generated line and column positions. * - origin
(aArgs)
| 98 | * - name: An optional original token name for this mapping. |
| 99 | */ |
| 100 | addMapping(aArgs) { |
| 101 | const generated = util.getArg(aArgs, "generated"); |
| 102 | const original = util.getArg(aArgs, "original", null); |
| 103 | let source = util.getArg(aArgs, "source", null); |
| 104 | let name = util.getArg(aArgs, "name", null); |
| 105 | |
| 106 | if (!this._skipValidation) { |
| 107 | this._validateMapping(generated, original, source, name); |
| 108 | } |
| 109 | |
| 110 | if (source != null) { |
| 111 | source = String(source); |
| 112 | if (!this._sources.has(source)) { |
| 113 | this._sources.add(source); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | if (name != null) { |
| 118 | name = String(name); |
| 119 | if (!this._names.has(name)) { |
| 120 | this._names.add(name); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | this._mappings.add({ |
| 125 | generatedLine: generated.line, |
| 126 | generatedColumn: generated.column, |
| 127 | originalLine: original && original.line, |
| 128 | originalColumn: original && original.column, |
| 129 | source, |
| 130 | name, |
| 131 | }); |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * Set the source content for a source file. |
no test coverage detected