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

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

Issue 11299225: Revert "Canonicalize raw type" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/typechecker.dart
diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
index f85ac49402e8bc600558731e9bc7e5c09f89f265..b192c23b444d7a8ec4862e84256633ca5fcf9365 100644
--- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
+++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
@@ -87,11 +87,6 @@ abstract class DartType {
bool operator ==(other);
- /**
- * Is [: true :] if this type has no explict type arguments.
- */
- bool get isRaw => true;
-
DartType asRaw() => this;
}
@@ -269,7 +264,7 @@ class MalformedType extends DartType {
}
class InterfaceType extends DartType {
- final ClassElement element;
+ final Element element;
final Link<DartType> typeArguments;
InterfaceType(this.element,
@@ -305,7 +300,7 @@ class InterfaceType extends DartType {
String toString() {
StringBuffer sb = new StringBuffer();
sb.add(name.slowToString());
- if (!isRaw) {
+ if (!typeArguments.isEmpty) {
sb.add('<');
typeArguments.printOn(sb, ', ');
sb.add('>');
@@ -330,9 +325,10 @@ class InterfaceType extends DartType {
return typeArguments == other.typeArguments;
}
- bool get isRaw => typeArguments.isEmpty || identical(this, element.rawType);
-
- InterfaceType asRaw() => element.rawType;
+ InterfaceType asRaw() {
+ if (typeArguments.isEmpty) return this;
+ return new InterfaceType(element);
+ }
}
class FunctionType extends DartType {
@@ -449,7 +445,7 @@ class TypedefType extends DartType {
String toString() {
StringBuffer sb = new StringBuffer();
sb.add(name.slowToString());
- if (!isRaw) {
+ if (!typeArguments.isEmpty) {
sb.add('<');
typeArguments.printOn(sb, ', ');
sb.add('>');
@@ -464,10 +460,6 @@ class TypedefType extends DartType {
if (!identical(element, other.element)) return false;
return typeArguments == other.typeArguments;
}
-
- bool get isRaw => typeArguments.isEmpty || identical(this, element.rawType);
-
- TypedefType asRaw() => element.rawType;
}
/**
@@ -485,7 +477,7 @@ class Types {
final Compiler compiler;
// TODO(karlklose): should we have a class Void?
final VoidType voidType;
- final DynamicType dynamicType;
+ final InterfaceType dynamicType;
Types(Compiler compiler, ClassElement dynamicElement)
: this.with(compiler, dynamicElement,
@@ -496,7 +488,7 @@ class Types {
LibraryElement library)
: voidType = new VoidType(new VoidElement(library)),
dynamicType = new DynamicType(dynamicElement) {
- dynamicElement.rawType = dynamicElement.thisType = dynamicType;
+ dynamicElement.type = dynamicType;
}
/** Returns true if t is a subtype of s */
@@ -513,9 +505,8 @@ class Types {
if (t is VoidType) {
return false;
- } else if (t is MalformedType || s is MalformedType) {
- // A malformed type should be treated as dynamic.
- return true;
+ } else if (t is MalformedType) {
+ return false;
} else if (t is InterfaceType) {
if (s is !InterfaceType) return false;
ClassElement tc = t.element;
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/codegen.dart ('k') | sdk/lib/_internal/compiler/implementation/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698