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

Side by Side Diff: packages/csslib/lib/src/analyzer.dart

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years 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 | « packages/csslib/lib/parser.dart ('k') | packages/csslib/lib/src/css_printer.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 part of csslib.parser; 5 part of csslib.parser;
6 6
7 // TODO(terry): Add optimizing phase to remove duplicated selectors in the same 7 // TODO(terry): Add optimizing phase to remove duplicated selectors in the same
8 // selector group (e.g., .btn, .btn { color: red; }). Also, look 8 // selector group (e.g., .btn, .btn { color: red; }). Also, look
9 // at simplifying selectors expressions too (much harder). 9 // at simplifying selectors expressions too (much harder).
10 // TODO(terry): Detect invalid directive usage. All @imports must occur before 10 // TODO(terry): Detect invalid directive usage. All @imports must occur before
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 456
457 void visitIncludeDirective(IncludeDirective node) { 457 void visitIncludeDirective(IncludeDirective node) {
458 if (map.containsKey(node.name)) { 458 if (map.containsKey(node.name)) {
459 var mixinDef = map[node.name]; 459 var mixinDef = map[node.name];
460 if (mixinDef is MixinRulesetDirective) { 460 if (mixinDef is MixinRulesetDirective) {
461 _TopLevelIncludeReplacer.replace( 461 _TopLevelIncludeReplacer.replace(
462 _messages, _styleSheet, node, mixinDef.rulesets); 462 _messages, _styleSheet, node, mixinDef.rulesets);
463 } else if (currDef is MixinRulesetDirective && _anyRulesets(currDef)) { 463 } else if (currDef is MixinRulesetDirective && _anyRulesets(currDef)) {
464 // currDef is MixinRulesetDirective 464 // currDef is MixinRulesetDirective
465 MixinRulesetDirective mixinRuleset = currDef; 465 MixinRulesetDirective mixinRuleset = currDef;
466 int index = mixinRuleset.rulesets.indexOf(node as dynamic); 466 int index = mixinRuleset.rulesets.indexOf(node);
467 mixinRuleset.rulesets.replaceRange(index, index + 1, [new NoOp()]); 467 mixinRuleset.rulesets.removeAt(index);
468 _messages.warning( 468 _messages.warning(
469 'Using declaration mixin ${node.name} as top-level mixin', 469 'Using declaration mixin ${node.name} as top-level mixin',
470 node.span); 470 node.span);
471 } 471 }
472 } else { 472 } else {
473 if (currDef is MixinRulesetDirective) { 473 if (currDef is MixinRulesetDirective) {
474 MixinRulesetDirective rulesetDirect = currDef as MixinRulesetDirective; 474 MixinRulesetDirective rulesetDirect = currDef as MixinRulesetDirective;
475 var index = 0; 475 rulesetDirect.rulesets.removeWhere((entry) {
476 rulesetDirect.rulesets.forEach((entry) {
477 if (entry == node) { 476 if (entry == node) {
478 rulesetDirect.rulesets.replaceRange(index, index + 1, [new NoOp()]);
479 _messages.warning('Undefined mixin ${node.name}', node.span); 477 _messages.warning('Undefined mixin ${node.name}', node.span);
478 return true;
480 } 479 }
481 index++; 480 return false;
482 }); 481 });
483 } 482 }
484 } 483 }
485 super.visitIncludeDirective(node); 484 super.visitIncludeDirective(node);
486 } 485 }
487 486
488 void visitMixinRulesetDirective(MixinRulesetDirective node) { 487 void visitMixinRulesetDirective(MixinRulesetDirective node) {
489 currDef = node; 488 currDef = node;
490 489
491 super.visitMixinRulesetDirective(node); 490 super.visitMixinRulesetDirective(node);
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 isLastNone = false; 1005 isLastNone = false;
1007 } 1006 }
1008 } else { 1007 } else {
1009 isLastNone = simpleSeq.isCombinatorNone; 1008 isLastNone = simpleSeq.isCombinatorNone;
1010 } 1009 }
1011 } 1010 }
1012 } 1011 }
1013 super.visitSelectorGroup(node); 1012 super.visitSelectorGroup(node);
1014 } 1013 }
1015 } 1014 }
OLDNEW
« no previous file with comments | « packages/csslib/lib/parser.dart ('k') | packages/csslib/lib/src/css_printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698