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

Side by Side Diff: lib/transformations/treeshaker.dart

Issue 2502343002: Store named parameters in sorted lists instead of using maps. (Closed)
Patch Set: Remove duplicates from named parameter lists to recover from erroneous inputs Created 4 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
« no previous file with comments | « lib/text/ast_to_text.dart ('k') | lib/type_algebra.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 kernel.tree_shaker; 5 library kernel.tree_shaker;
6 6
7 import '../ast.dart'; 7 import '../ast.dart';
8 import '../class_hierarchy.dart'; 8 import '../class_hierarchy.dart';
9 import '../core_types.dart'; 9 import '../core_types.dart';
10 10
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 visitBivariant(typeArgument); 750 visitBivariant(typeArgument);
751 } 751 }
752 } 752 }
753 } 753 }
754 754
755 visitFunctionType(FunctionType node) { 755 visitFunctionType(FunctionType node) {
756 visit(node.returnType); 756 visit(node.returnType);
757 for (int i = 0; i < node.positionalParameters.length; ++i) { 757 for (int i = 0; i < node.positionalParameters.length; ++i) {
758 visitContravariant(node.positionalParameters[i]); 758 visitContravariant(node.positionalParameters[i]);
759 } 759 }
760 node.namedParameters.values.forEach(visitContravariant); 760 for (int i = 0; i < node.namedParameters.length; ++i) {
761 visitContravariant(node.namedParameters[i].type);
762 }
761 } 763 }
762 764
763 visitTypeParameterType(TypeParameterType node) {} 765 visitTypeParameterType(TypeParameterType node) {}
764 766
765 /// Just treat a couple of whitelisted classes as having covariant type 767 /// Just treat a couple of whitelisted classes as having covariant type
766 /// parameters. 768 /// parameters.
767 bool isWhitelistedCovariant(Class classNode) { 769 bool isWhitelistedCovariant(Class classNode) {
768 if (classNode.typeParameters.isEmpty) return false; 770 if (classNode.typeParameters.isEmpty) return false;
769 CoreTypes coreTypes = shaker.coreTypes; 771 CoreTypes coreTypes = shaker.coreTypes;
770 return classNode == coreTypes.iteratorClass || 772 return classNode == coreTypes.iteratorClass ||
771 classNode == coreTypes.iterableClass || 773 classNode == coreTypes.iterableClass ||
772 classNode == coreTypes.futureClass || 774 classNode == coreTypes.futureClass ||
773 classNode == coreTypes.streamClass || 775 classNode == coreTypes.streamClass ||
774 classNode == coreTypes.listClass || 776 classNode == coreTypes.listClass ||
775 classNode == coreTypes.mapClass; 777 classNode == coreTypes.mapClass;
776 } 778 }
777 } 779 }
OLDNEW
« no previous file with comments | « lib/text/ast_to_text.dart ('k') | lib/type_algebra.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698