| 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 * @implements {WebInspector.FormatterWorkerContentParser} | 7 * @implements {WebInspector.FormatterWorkerContentParser} |
| 8 */ | 8 */ |
| 9 WebInspector.SCSSParser = function() | 9 WebInspector.SCSSParser = function() |
| 10 { | 10 { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 output.push(rule); | 64 output.push(rule); |
| 65 }, | 65 }, |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * @param {!Gonzales.Node} node | 68 * @param {!Gonzales.Node} node |
| 69 * @param {!Array<!WebInspector.SCSSParser.Property>} output | 69 * @param {!Array<!WebInspector.SCSSParser.Property>} output |
| 70 */ | 70 */ |
| 71 _handleDeclaration: function(node, output) | 71 _handleDeclaration: function(node, output) |
| 72 { | 72 { |
| 73 var propertyNode = node.content.find(node => node.type === "property"); | 73 var propertyNode = node.content.find(node => node.type === "property"); |
| 74 var delimeterNode = node.content.find(node => node.type === "propertyDel
imiter"); | |
| 75 var valueNode = node.content.find(node => node.type === "value"); | 74 var valueNode = node.content.find(node => node.type === "value"); |
| 76 if (!propertyNode || !delimeterNode || !valueNode) | 75 if (!propertyNode || !valueNode) |
| 77 return; | 76 return; |
| 78 | 77 |
| 79 var nameRange = new WebInspector.TextRange(propertyNode.start.line - 1,
propertyNode.start.column - 1, delimeterNode.start.line - 1, delimeterNode.start
.column - 1); | 78 var nameRange = WebInspector.SCSSParser.rangeFromNode(propertyNode); |
| 80 var valueRange = new WebInspector.TextRange(delimeterNode.end.line - 1,
delimeterNode.end.column, valueNode.end.line - 1, valueNode.end.column); | 79 var valueRange = WebInspector.SCSSParser.rangeFromNode(valueNode); |
| 81 var range = /** @type {!WebInspector.TextRange} */(node.declarationRange
); | 80 var range = /** @type {!WebInspector.TextRange} */(node.declarationRange
); |
| 82 | 81 |
| 83 var property = new WebInspector.SCSSParser.Property(range, nameRange, va
lueRange, false); | 82 var property = new WebInspector.SCSSParser.Property(range, nameRange, va
lueRange, false); |
| 84 output.push(property); | 83 output.push(property); |
| 85 }, | 84 }, |
| 86 | 85 |
| 87 /** | 86 /** |
| 88 * @param {!Gonzales.Node} node | 87 * @param {!Gonzales.Node} node |
| 89 * @param {!Array<!WebInspector.SCSSParser.Property>} output | 88 * @param {!Array<!WebInspector.SCSSParser.Property>} output |
| 90 */ | 89 */ |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 lastDeclaration = child; | 224 lastDeclaration = child; |
| 226 lastDeclaration.declarationRange = WebInspector.TextRange.createFrom
Location(child.start.line - 1, child.start.column - 1); | 225 lastDeclaration.declarationRange = WebInspector.TextRange.createFrom
Location(child.start.line - 1, child.start.column - 1); |
| 227 } | 226 } |
| 228 WebInspector.SCSSParser.extractNodes(child, blocks, lastBlock); | 227 WebInspector.SCSSParser.extractNodes(child, blocks, lastBlock); |
| 229 } | 228 } |
| 230 if (lastDeclaration) { | 229 if (lastDeclaration) { |
| 231 lastDeclaration.declarationRange.endLine = node.end.line - 1; | 230 lastDeclaration.declarationRange.endLine = node.end.line - 1; |
| 232 lastDeclaration.declarationRange.endColumn = node.end.column - 1; | 231 lastDeclaration.declarationRange.endColumn = node.end.column - 1; |
| 233 } | 232 } |
| 234 } | 233 } |
| OLD | NEW |