OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 */ | 7 */ |
8 WebInspector.ASTService = function() | 8 WebInspector.ASTService = function() |
9 { | 9 { |
10 this._sassInitPromise = self.runtime.instancePromise(WebInspector.TokenizerF
actory); | |
11 this._terminated = false; | |
12 } | 10 } |
13 | 11 |
14 WebInspector.ASTService.prototype = { | 12 WebInspector.ASTService.prototype = { |
15 /** | 13 /** |
16 * @param {string} url | 14 * @param {string} url |
17 * @param {string} text | 15 * @param {string} text |
18 * @return {!Promise<!WebInspector.SASSSupport.AST>} | 16 * @return {!Promise<!WebInspector.SASSSupport.AST>} |
19 */ | 17 */ |
20 parseCSS: function(url, text) | 18 parseCSS: function(url, text) |
21 { | 19 { |
22 console.assert(!this._terminated, "Illegal call parseCSS on terminated A
STService."); | |
23 return WebInspector.SASSSupport.parseCSS(url, text); | 20 return WebInspector.SASSSupport.parseCSS(url, text); |
24 }, | 21 }, |
25 | 22 |
26 /** | 23 /** |
27 * @param {string} url | 24 * @param {string} url |
28 * @param {string} text | 25 * @param {string} text |
29 * @return {!Promise<!WebInspector.SASSSupport.AST>} | 26 * @return {!Promise<!WebInspector.SASSSupport.AST>} |
30 */ | 27 */ |
31 parseSCSS: function(url, text) | 28 parseSCSS: function(url, text) |
32 { | 29 { |
33 console.assert(!this._terminated, "Illegal call parseSCSS on terminated
ASTService."); | 30 return WebInspector.SASSSupport.parseSCSS(url, text); |
34 return this._sassInitPromise.then(tokenizer => WebInspector.SASSSupport.
parseSCSS(tokenizer, url, text)); | |
35 }, | 31 }, |
36 } | 32 } |
OLD | NEW |