OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 /** | 4 /** |
5 * @implements {SDK.SourceMap} | 5 * @implements {SDK.SourceMap} |
6 * @unrestricted | 6 * @unrestricted |
7 */ | 7 */ |
8 Sass.ASTSourceMap = class { | 8 Sass.ASTSourceMap = class { |
9 /** | 9 /** |
10 * @param {string} compiledURL | 10 * @param {string} compiledURL |
11 * @param {string} sourceMapURL | 11 * @param {string} sourceMapURL |
12 * @param {!Map<string, !Sass.SASSSupport.AST>} models | 12 * @param {!Map<string, !Sass.SASSSupport.AST>} models |
13 * @param {?function(!Sass.ASTSourceMap, !Array<!Common.TextRange>, !Array<str
ing>):!Promise<?SDK.SourceMap.EditResult>} editCallback | 13 * @param {?function(!Sass.ASTSourceMap, !Array<!TextUtils.TextRange>, !Array<
string>):!Promise<?SDK.SourceMap.EditResult>} editCallback |
14 */ | 14 */ |
15 constructor(compiledURL, sourceMapURL, models, editCallback) { | 15 constructor(compiledURL, sourceMapURL, models, editCallback) { |
16 this._editCallback = editCallback; | 16 this._editCallback = editCallback; |
17 this._compiledURL = compiledURL; | 17 this._compiledURL = compiledURL; |
18 this._sourceMapURL = sourceMapURL; | 18 this._sourceMapURL = sourceMapURL; |
19 /** @type {!Map<string, !Sass.SASSSupport.AST>} */ | 19 /** @type {!Map<string, !Sass.SASSSupport.AST>} */ |
20 this._models = models; | 20 this._models = models; |
21 /** @type {!Map<!Sass.SASSSupport.TextNode, !Sass.SASSSupport.TextNode>} */ | 21 /** @type {!Map<!Sass.SASSSupport.TextNode, !Sass.SASSSupport.TextNode>} */ |
22 this._compiledToSource = new Map(); | 22 this._compiledToSource = new Map(); |
23 /** @type {!Multimap<!Sass.SASSSupport.TextNode, !Sass.SASSSupport.TextNode>
} */ | 23 /** @type {!Multimap<!Sass.SASSSupport.TextNode, !Sass.SASSSupport.TextNode>
} */ |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 /** | 91 /** |
92 * @override | 92 * @override |
93 * @return {boolean} | 93 * @return {boolean} |
94 */ | 94 */ |
95 editable() { | 95 editable() { |
96 return !!this._editCallback; | 96 return !!this._editCallback; |
97 } | 97 } |
98 | 98 |
99 /** | 99 /** |
100 * @override | 100 * @override |
101 * @param {!Array<!Common.TextRange>} ranges | 101 * @param {!Array<!TextUtils.TextRange>} ranges |
102 * @param {!Array<string>} texts | 102 * @param {!Array<string>} texts |
103 * @return {!Promise<?SDK.SourceMap.EditResult>} | 103 * @return {!Promise<?SDK.SourceMap.EditResult>} |
104 */ | 104 */ |
105 editCompiled(ranges, texts) { | 105 editCompiled(ranges, texts) { |
106 return this._editCallback.call(null, this, ranges, texts); | 106 return this._editCallback.call(null, this, ranges, texts); |
107 } | 107 } |
108 | 108 |
109 /** | 109 /** |
110 * @return {!Sass.SASSSupport.AST} | 110 * @return {!Sass.SASSSupport.AST} |
111 */ | 111 */ |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 var sourceNode = /** @type {!Sass.SASSSupport.TextNode} */ (this._compiled
ToSource.get(compiledNode)); | 196 var sourceNode = /** @type {!Sass.SASSSupport.TextNode} */ (this._compiled
ToSource.get(compiledNode)); |
197 var mappedCompiledNode = | 197 var mappedCompiledNode = |
198 /** @type {!Sass.SASSSupport.TextNode} */ (outNodeMapping.get(compiled
Node) || compiledNode); | 198 /** @type {!Sass.SASSSupport.TextNode} */ (outNodeMapping.get(compiled
Node) || compiledNode); |
199 var mappedSourceNode = | 199 var mappedSourceNode = |
200 /** @type {!Sass.SASSSupport.TextNode} */ (outNodeMapping.get(sourceNo
de) || sourceNode); | 200 /** @type {!Sass.SASSSupport.TextNode} */ (outNodeMapping.get(sourceNo
de) || sourceNode); |
201 newMap.addMapping(mappedCompiledNode, mappedSourceNode); | 201 newMap.addMapping(mappedCompiledNode, mappedSourceNode); |
202 } | 202 } |
203 return newMap; | 203 return newMap; |
204 } | 204 } |
205 }; | 205 }; |
OLD | NEW |