OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of csslib.parser; | 5 part of csslib.parser; |
6 | 6 |
7 /** | 7 /** |
8 * CSS polyfill emits CSS to be understood by older parsers that which do not | 8 * CSS polyfill emits CSS to be understood by older parsers that which do not |
9 * understand (var, calc, etc.). | 9 * understand (var, calc, etc.). |
10 */ | 10 */ |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 _messages.warning("Variable is not defined.", node.span); | 163 _messages.warning("Variable is not defined.", node.span); |
164 } | 164 } |
165 | 165 |
166 var oldExpressions = currentExpressions; | 166 var oldExpressions = currentExpressions; |
167 currentExpressions = node.defaultValues; | 167 currentExpressions = node.defaultValues; |
168 super.visitVarUsage(node); | 168 super.visitVarUsage(node); |
169 currentExpressions = oldExpressions; | 169 currentExpressions = oldExpressions; |
170 } | 170 } |
171 | 171 |
172 List<Expression> resolveUsageTerminal(VarUsage usage) { | 172 List<Expression> resolveUsageTerminal(VarUsage usage) { |
173 var result = []; | 173 var result = <Expression>[]; |
174 | 174 |
175 var varDef = _knownVarDefs[usage.name]; | 175 var varDef = _knownVarDefs[usage.name]; |
176 var expressions; | 176 var expressions; |
177 if (varDef == null) { | 177 if (varDef == null) { |
178 // VarDefinition not found try the defaultValues. | 178 // VarDefinition not found try the defaultValues. |
179 expressions = usage.defaultValues; | 179 expressions = usage.defaultValues; |
180 } else { | 180 } else { |
181 // Use the VarDefinition found. | 181 // Use the VarDefinition found. |
182 expressions = (varDef.expression as Expressions).expressions; | 182 expressions = (varDef.expression as Expressions).expressions; |
183 } | 183 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 246 } |
247 } else { | 247 } else { |
248 // Return real CSS property. | 248 // Return real CSS property. |
249 return varDef; | 249 return varDef; |
250 } | 250 } |
251 } | 251 } |
252 | 252 |
253 // Didn't point to a var definition that existed. | 253 // Didn't point to a var definition that existed. |
254 return varDef; | 254 return varDef; |
255 } | 255 } |
OLD | NEW |