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

Unified Diff: sdk/lib/_internal/compiler/implementation/dart_types.dart

Issue 24615003: Add DartType.treatAsRaw to treat List<dynamic> as List in the backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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: sdk/lib/_internal/compiler/implementation/dart_types.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_types.dart b/sdk/lib/_internal/compiler/implementation/dart_types.dart
index f301f9b04ba697240f45788213cb15ed98e001f5..7256394f9c3e22e480db68a745df3ed4582d3ec4 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_types.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_types.dart
@@ -93,6 +93,10 @@ abstract class DartType {
/// Returns the raw version of this type.
DartType asRaw() => this;
+ /// Is [: true :] if this type has no non-dynamic type arguments.
+ bool get treatAsRaw => isRaw;
+
+
/// Is [: true :] if this type should be treated as the dynamic type.
bool get treatAsDynamic => false;
@@ -424,6 +428,14 @@ abstract class GenericType extends DartType {
bool get isRaw => typeArguments.isEmpty || identical(this, element.rawType);
GenericType asRaw() => element.rawType;
+
+ bool get treatAsRaw {
+ if (isRaw) return true;
+ for (Link<DartType> link = typeArguments; !link.isEmpty; link = link.tail) {
+ if (!link.head.treatAsDynamic) return false;
+ }
+ return true;
+ }
}
class InterfaceType extends GenericType {

Powered by Google App Engine
This is Rietveld 408576698