OLD | NEW |
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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 } | 589 } |
590 } | 590 } |
591 | 591 |
592 /** | 592 /** |
593 * Given a mixin's defined arguments return a cloned mixin defintion that has | 593 * Given a mixin's defined arguments return a cloned mixin defintion that has |
594 * replaced all defined arguments with user's supplied VarUsages. | 594 * replaced all defined arguments with user's supplied VarUsages. |
595 */ | 595 */ |
596 MixinDefinition transform(List callArgs) { | 596 MixinDefinition transform(List callArgs) { |
597 // TODO(terry): Handle default arguments and varArgs. | 597 // TODO(terry): Handle default arguments and varArgs. |
598 // Transform mixin with callArgs. | 598 // Transform mixin with callArgs. |
599 var index = 0; | |
600 for (var index = 0; index < _definedArgs.length; index++) { | 599 for (var index = 0; index < _definedArgs.length; index++) { |
601 var definedArg = _definedArgs[index]; | 600 var definedArg = _definedArgs[index]; |
602 VarDefinition varDef; | 601 VarDefinition varDef; |
603 if (definedArg is VarDefinition) { | 602 if (definedArg is VarDefinition) { |
604 varDef = definedArg; | 603 varDef = definedArg; |
605 } else if (definedArg is VarDefinitionDirective) { | 604 } else if (definedArg is VarDefinitionDirective) { |
606 VarDefinitionDirective varDirective = definedArg; | 605 VarDefinitionDirective varDirective = definedArg; |
607 varDef = varDirective.def; | 606 varDef = varDirective.def; |
608 } | 607 } |
609 var callArg = callArgs[index]; | 608 var callArg = callArgs[index]; |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 super.visitDeclarationGroup(node); | 900 super.visitDeclarationGroup(node); |
902 } | 901 } |
903 } | 902 } |
904 | 903 |
905 /** Find all @extend to create inheritance. */ | 904 /** Find all @extend to create inheritance. */ |
906 class AllExtends extends Visitor { | 905 class AllExtends extends Visitor { |
907 final Map<String, List<SelectorGroup>> inherits = | 906 final Map<String, List<SelectorGroup>> inherits = |
908 new Map<String, List<SelectorGroup>>(); | 907 new Map<String, List<SelectorGroup>>(); |
909 | 908 |
910 SelectorGroup _currSelectorGroup; | 909 SelectorGroup _currSelectorGroup; |
911 List _currDecls; | |
912 int _currDeclIndex; | 910 int _currDeclIndex; |
913 List<int> _extendsToRemove = []; | 911 List<int> _extendsToRemove = []; |
914 | 912 |
915 void visitRuleSet(RuleSet node) { | 913 void visitRuleSet(RuleSet node) { |
916 var oldSelectorGroup = _currSelectorGroup; | 914 var oldSelectorGroup = _currSelectorGroup; |
917 _currSelectorGroup = node.selectorGroup; | 915 _currSelectorGroup = node.selectorGroup; |
918 | 916 |
919 super.visitRuleSet(node); | 917 super.visitRuleSet(node); |
920 | 918 |
921 _currSelectorGroup = oldSelectorGroup; | 919 _currSelectorGroup = oldSelectorGroup; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 isLastNone = false; | 1006 isLastNone = false; |
1009 } | 1007 } |
1010 } else { | 1008 } else { |
1011 isLastNone = simpleSeq.isCombinatorNone; | 1009 isLastNone = simpleSeq.isCombinatorNone; |
1012 } | 1010 } |
1013 } | 1011 } |
1014 } | 1012 } |
1015 super.visitSelectorGroup(node); | 1013 super.visitSelectorGroup(node); |
1016 } | 1014 } |
1017 } | 1015 } |
OLD | NEW |