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

Side by Side Diff: pkg/csslib/lib/visitor.dart

Issue 60983003: pkg/csslib: fixed analysis error, more cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nits Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « pkg/csslib/lib/src/tree_printer.dart ('k') | pkg/csslib/test/testing.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library csslib.visitor; 5 library csslib.visitor;
6 6
7 import 'package:source_maps/span.dart' show Span; 7 import 'package:source_maps/span.dart' show Span;
8 import 'parser.dart'; 8 import 'parser.dart';
9 9
10 part 'src/css_printer.dart'; 10 part 'src/css_printer.dart';
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 void visitMarginExpression(MarginExpression node); 104 void visitMarginExpression(MarginExpression node);
105 void visitBorderExpression(BorderExpression node); 105 void visitBorderExpression(BorderExpression node);
106 void visitHeightExpression(HeightExpression node); 106 void visitHeightExpression(HeightExpression node);
107 void visitPaddingExpression(PaddingExpression node); 107 void visitPaddingExpression(PaddingExpression node);
108 void visitWidthExpression(WidthExpression node); 108 void visitWidthExpression(WidthExpression node);
109 } 109 }
110 110
111 /** Base vistor class for the style sheet AST. */ 111 /** Base vistor class for the style sheet AST. */
112 class Visitor implements VisitorBase { 112 class Visitor implements VisitorBase {
113 /** Helper function to walk a list of nodes. */ 113 /** Helper function to walk a list of nodes. */
114 void _visitNodeList(list) { 114 void _visitNodeList(List<TreeNode> list) {
115 // Don't use iterable otherwise the list can't grow while using Visitor. 115 // Don't use iterable otherwise the list can't grow while using Visitor.
116 // It certainly can't have items deleted before the index being iterated 116 // It certainly can't have items deleted before the index being iterated
117 // but items could be added after the index. 117 // but items could be added after the index.
118 for (var index = 0; index < list.length; index++) { 118 for (var index = 0; index < list.length; index++) {
119 list[index].visit(this); 119 list[index].visit(this);
120 } 120 }
121 } 121 }
122 122
123 void visitTree(StyleSheet tree) => visitStyleSheet(tree); 123 void visitTree(StyleSheet tree) => visitStyleSheet(tree);
124 124
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 void visitKeyFrameBlock(KeyFrameBlock node) { 187 void visitKeyFrameBlock(KeyFrameBlock node) {
188 visitExpressions(node._blockSelectors); 188 visitExpressions(node._blockSelectors);
189 visitDeclarationGroup(node._declarations); 189 visitDeclarationGroup(node._declarations);
190 } 190 }
191 191
192 void visitFontFaceDirective(FontFaceDirective node) { 192 void visitFontFaceDirective(FontFaceDirective node) {
193 visitDeclarationGroup(node._declarations); 193 visitDeclarationGroup(node._declarations);
194 } 194 }
195 195
196 void visitStyletDirective(StyletDirective node) { 196 void visitStyletDirective(StyletDirective node) {
197 _visitNodeList(node._rulesets); 197 _visitNodeList(node.rulesets);
198 } 198 }
199 199
200 void visitNamespaceDirective(NamespaceDirective node) { } 200 void visitNamespaceDirective(NamespaceDirective node) { }
201 201
202 void visitVarDefinitionDirective(VarDefinitionDirective node) { 202 void visitVarDefinitionDirective(VarDefinitionDirective node) {
203 visitVarDefinition(node.def); 203 visitVarDefinition(node.def);
204 } 204 }
205 205
206 void visitMixinRulesetDirective(MixinRulesetDirective node) { 206 void visitMixinRulesetDirective(MixinRulesetDirective node) {
207 _visitNodeList(node.rulesets); 207 _visitNodeList(node.rulesets);
(...skipping 15 matching lines...) Expand all
223 void visitContentDirective(ContentDirective node) { 223 void visitContentDirective(ContentDirective node) {
224 // TODO(terry): TBD 224 // TODO(terry): TBD
225 } 225 }
226 226
227 void visitRuleSet(RuleSet node) { 227 void visitRuleSet(RuleSet node) {
228 visitSelectorGroup(node._selectorGroup); 228 visitSelectorGroup(node._selectorGroup);
229 visitDeclarationGroup(node._declarationGroup); 229 visitDeclarationGroup(node._declarationGroup);
230 } 230 }
231 231
232 void visitDeclarationGroup(DeclarationGroup node) { 232 void visitDeclarationGroup(DeclarationGroup node) {
233 _visitNodeList(node._declarations); 233 _visitNodeList(node.declarations);
234 } 234 }
235 235
236 void visitMarginGroup(MarginGroup node) => visitDeclarationGroup(node); 236 void visitMarginGroup(MarginGroup node) => visitDeclarationGroup(node);
237 237
238 void visitDeclaration(Declaration node) { 238 void visitDeclaration(Declaration node) {
239 visitIdentifier(node._property); 239 visitIdentifier(node._property);
240 if (node._expression != null) node._expression.visit(this); 240 if (node._expression != null) node._expression.visit(this);
241 } 241 }
242 242
243 void visitVarDefinition(VarDefinition node) { 243 void visitVarDefinition(VarDefinition node) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 void visitPseudoClassFunctionSelector(PseudoClassFunctionSelector node) => 322 void visitPseudoClassFunctionSelector(PseudoClassFunctionSelector node) =>
323 visitSimpleSelector(node); 323 visitSimpleSelector(node);
324 324
325 void visitPseudoElementFunctionSelector(PseudoElementFunctionSelector node) => 325 void visitPseudoElementFunctionSelector(PseudoElementFunctionSelector node) =>
326 visitSimpleSelector(node); 326 visitSimpleSelector(node);
327 327
328 void visitNegationSelector(NegationSelector node) => 328 void visitNegationSelector(NegationSelector node) =>
329 visitSimpleSelector(node); 329 visitSimpleSelector(node);
330 330
331 void visitSelectorExpression(SelectorExpression node) { 331 void visitSelectorExpression(SelectorExpression node) {
332 _visitNodeList(node._expressions); 332 _visitNodeList(node.expressions);
333 } 333 }
334 334
335 void visitUnicodeRangeTerm(UnicodeRangeTerm node) { } 335 void visitUnicodeRangeTerm(UnicodeRangeTerm node) { }
336 336
337 void visitLiteralTerm(LiteralTerm node) { } 337 void visitLiteralTerm(LiteralTerm node) { }
338 338
339 void visitHexColorTerm(HexColorTerm node) { } 339 void visitHexColorTerm(HexColorTerm node) { }
340 340
341 void visitNumberTerm(NumberTerm node) { } 341 void visitNumberTerm(NumberTerm node) { }
342 342
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 void visitPaddingExpression(PaddingExpression node) { 475 void visitPaddingExpression(PaddingExpression node) {
476 // TODO(terry): TBD 476 // TODO(terry): TBD
477 throw UnimplementedError; 477 throw UnimplementedError;
478 } 478 }
479 479
480 void visitWidthExpression(WidthExpression node) { 480 void visitWidthExpression(WidthExpression node) {
481 // TODO(terry): TBD 481 // TODO(terry): TBD
482 throw UnimplementedError; 482 throw UnimplementedError;
483 } 483 }
484 } 484 }
OLDNEW
« no previous file with comments | « pkg/csslib/lib/src/tree_printer.dart ('k') | pkg/csslib/test/testing.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698