Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: lib/src/polyfill.dart

Issue 873313003: Cleanup some ambiguous and incorrect types and disable a case that in analyzer.dart that seems like… (Closed) Base URL: git@github.com:dart-lang/csslib.git@master
Patch Set: ptal Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/analyzer.dart ('k') | lib/src/property.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (def.badUsage) { 137 if (def.badUsage) {
138 // Remove any expressions pointing to a bad var definition. 138 // Remove any expressions pointing to a bad var definition.
139 expressions.removeAt(index); 139 expressions.removeAt(index);
140 return; 140 return;
141 } 141 }
142 _resolveVarUsage(currentExpressions, index, 142 _resolveVarUsage(currentExpressions, index,
143 _findTerminalVarDefinition(_knownVarDefs, def)); 143 _findTerminalVarDefinition(_knownVarDefs, def));
144 } else if (node.defaultValues.any((e) => e is VarUsage)) { 144 } else if (node.defaultValues.any((e) => e is VarUsage)) {
145 // Don't have a VarDefinition need to use default values resolve all 145 // Don't have a VarDefinition need to use default values resolve all
146 // default values. 146 // default values.
147 var terminalDefaults = []; 147 var terminalDefaults = <Expression>[];
148 for (var defaultValue in node.defaultValues) { 148 for (var defaultValue in node.defaultValues) {
149 terminalDefaults.addAll(resolveUsageTerminal(defaultValue)); 149 terminalDefaults.addAll(resolveUsageTerminal(defaultValue));
150 } 150 }
151 expressions.replaceRange(index, index + 1, terminalDefaults); 151 expressions.replaceRange(index, index + 1, terminalDefaults);
152 } else if (node.defaultValues.isNotEmpty){ 152 } else if (node.defaultValues.isNotEmpty){
153 // No VarDefinition but default value is a terminal expression; use it. 153 // No VarDefinition but default value is a terminal expression; use it.
154 expressions.replaceRange(index, index + 1, node.defaultValues); 154 expressions.replaceRange(index, index + 1, node.defaultValues);
155 } else { 155 } else {
156 if (currVarDefinition != null) { 156 if (currVarDefinition != null) {
157 currVarDefinition.badUsage = true; 157 currVarDefinition.badUsage = true;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 193
194 // We're at a terminal just return the VarDefinition expression. 194 // We're at a terminal just return the VarDefinition expression.
195 if (result.isEmpty && varDef != null) { 195 if (result.isEmpty && varDef != null) {
196 result = (varDef.expression as Expressions).expressions; 196 result = (varDef.expression as Expressions).expressions;
197 } 197 }
198 198
199 return result; 199 return result;
200 } 200 }
201 201
202 _resolveVarUsage(List<Expressions> expressions, int index, 202 _resolveVarUsage(List<Expression> expressions, int index,
203 VarDefinition def) { 203 VarDefinition def) {
204 var defExpressions = (def.expression as Expressions).expressions; 204 var defExpressions = (def.expression as Expressions).expressions;
205 expressions.replaceRange(index, index + 1, defExpressions); 205 expressions.replaceRange(index, index + 1, defExpressions);
206 } 206 }
207 } 207 }
208 208
209 /** Remove all var definitions. */ 209 /** Remove all var definitions. */
210 class _RemoveVarDefinitions extends Visitor { 210 class _RemoveVarDefinitions extends Visitor {
211 void visitTree(StyleSheet tree) { 211 void visitTree(StyleSheet tree) {
212 visitStyleSheet(tree); 212 visitStyleSheet(tree);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 249 }
250 } else { 250 } else {
251 // Return real CSS property. 251 // Return real CSS property.
252 return varDef; 252 return varDef;
253 } 253 }
254 } 254 }
255 255
256 // Didn't point to a var definition that existed. 256 // Didn't point to a var definition that existed.
257 return varDef; 257 return varDef;
258 } 258 }
OLDNEW
« no previous file with comments | « lib/src/analyzer.dart ('k') | lib/src/property.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698