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

Unified Diff: pkg/compiler/lib/src/elements/types.dart

Issue 2797173004: Remove use of Element in ResolutionEnqueuerListener. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/elements/types.dart
diff --git a/pkg/compiler/lib/src/elements/types.dart b/pkg/compiler/lib/src/elements/types.dart
index d3f68833485e7a8b3d9b3bff99b7d8632f8d7edf..f169ef21f0e43b360f7e1573e7c8f30377859aaf 100644
--- a/pkg/compiler/lib/src/elements/types.dart
+++ b/pkg/compiler/lib/src/elements/types.dart
@@ -59,6 +59,9 @@ abstract class DartType {
/// Is `true` if this type is a malformed type.
bool get isMalformed => false;
+
+ /// Whether this type contains a type variable.
+ bool get containsTypeVariables => false;
}
class InterfaceType extends DartType {
@@ -67,6 +70,9 @@ class InterfaceType extends DartType {
InterfaceType(this.element, this.typeArguments);
+ bool get containsTypeVariables =>
+ typeArguments.any((type) => type.containsTypeVariables);
+
int get hashCode {
int hash = element.hashCode;
for (DartType argument in typeArguments) {
@@ -108,6 +114,8 @@ class TypeVariableType extends DartType {
bool get isTypeVariable => true;
+ bool get containsTypeVariables => true;
+
int get hashCode => 17 * element.hashCode;
bool operator ==(other) {
@@ -161,6 +169,13 @@ class FunctionType extends DartType {
this.namedParameters,
this.namedParameterTypes);
+ bool get containsTypeVariables {
+ return returnType.containsTypeVariables ||
+ parameterTypes.any((type) => type.containsTypeVariables) ||
+ optionalParameterTypes.any((type) => type.containsTypeVariables) ||
+ namedParameterTypes.any((type) => type.containsTypeVariables);
+ }
+
bool get isFunctionType => true;
int get hashCode {
« no previous file with comments | « pkg/compiler/lib/src/elements/entities.dart ('k') | pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698