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

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

Issue 2849803002: Revert "Add typedef AST node boilerplate." (Closed)
Patch Set: Created 3 years, 7 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
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 import '../type_environment.dart'; 10 import '../type_environment.dart';
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 // for external purposes. 1049 // for external purposes.
1050 // TODO(asgerf): Variance analysis might pay off for other external APIs. 1050 // TODO(asgerf): Variance analysis might pay off for other external APIs.
1051 if (isWhitelistedCovariant(node.classNode)) { 1051 if (isWhitelistedCovariant(node.classNode)) {
1052 visitCovariant(typeArgument); 1052 visitCovariant(typeArgument);
1053 } else { 1053 } else {
1054 visitInvariant(typeArgument); 1054 visitInvariant(typeArgument);
1055 } 1055 }
1056 } 1056 }
1057 } 1057 }
1058 1058
1059 visitTypedefType(TypedefType node) {
1060 throw 'TypedefType is not implemented in tree shaker';
1061 }
1062
1063 visitFunctionType(FunctionType node) { 1059 visitFunctionType(FunctionType node) {
1064 visit(node.returnType); 1060 visit(node.returnType);
1065 for (int i = 0; i < node.positionalParameters.length; ++i) { 1061 for (int i = 0; i < node.positionalParameters.length; ++i) {
1066 visitContravariant(node.positionalParameters[i]); 1062 visitContravariant(node.positionalParameters[i]);
1067 } 1063 }
1068 for (int i = 0; i < node.namedParameters.length; ++i) { 1064 for (int i = 0; i < node.namedParameters.length; ++i) {
1069 visitContravariant(node.namedParameters[i].type); 1065 visitContravariant(node.namedParameters[i].type);
1070 } 1066 }
1071 } 1067 }
1072 1068
1073 visitTypeParameterType(TypeParameterType node) {} 1069 visitTypeParameterType(TypeParameterType node) {}
1074 1070
1075 /// Just treat a couple of whitelisted classes as having covariant type 1071 /// Just treat a couple of whitelisted classes as having covariant type
1076 /// parameters. 1072 /// parameters.
1077 bool isWhitelistedCovariant(Class classNode) { 1073 bool isWhitelistedCovariant(Class classNode) {
1078 if (classNode.typeParameters.isEmpty) return false; 1074 if (classNode.typeParameters.isEmpty) return false;
1079 CoreTypes coreTypes = shaker.coreTypes; 1075 CoreTypes coreTypes = shaker.coreTypes;
1080 return classNode == coreTypes.iteratorClass || 1076 return classNode == coreTypes.iteratorClass ||
1081 classNode == coreTypes.iterableClass || 1077 classNode == coreTypes.iterableClass ||
1082 classNode == coreTypes.futureClass || 1078 classNode == coreTypes.futureClass ||
1083 classNode == coreTypes.streamClass || 1079 classNode == coreTypes.streamClass ||
1084 classNode == coreTypes.listClass || 1080 classNode == coreTypes.listClass ||
1085 classNode == coreTypes.mapClass; 1081 classNode == coreTypes.mapClass;
1086 } 1082 }
1087 } 1083 }
1088 1084
1089 /// Exception that is thrown to stop the tree shaking analysis when a use 1085 /// Exception that is thrown to stop the tree shaking analysis when a use
1090 /// of `dart:mirrors` is found. 1086 /// of `dart:mirrors` is found.
1091 class _UsingMirrorsException {} 1087 class _UsingMirrorsException {}
OLDNEW
« no previous file with comments | « pkg/kernel/lib/transformations/reify/transformation/remove_generics.dart ('k') | pkg/kernel/lib/type_algebra.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698