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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 11418173: 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/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 713a03c693cb06790cdc2635bc36374a88781c5a..40107bcbbace9b7ab8827a3bd69bb5f90f46d3f9 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -1128,6 +1128,7 @@ class TypeResolver {
} else if (element.isClass()) {
ClassElement cls = element;
cls.ensureResolved(compiler);
+ cls.computeType(compiler);
Link<DartType> arguments =
resolveTypeArguments(node, cls.typeVariables,
inStaticContext, scope,
@@ -1142,7 +1143,12 @@ class TypeResolver {
type = new MalformedType(
new MalformedTypeElement(node, element));
} else {
- type = new InterfaceType(cls.declaration, arguments);
+ if (arguments.isEmpty) {
+ // Use the canonical raw type if the class is generic.
+ type = cls.rawType;
+ } else {
+ type = new InterfaceType(cls.declaration, arguments);
+ }
}
}
} else if (element.isTypedef()) {
@@ -1157,7 +1163,11 @@ class TypeResolver {
// Return the canonical type if it has no type parameters.
type = typdef.computeType(compiler);
} else {
- type = new TypedefType(typdef, arguments);
+ if (arguments.isEmpty) {
+ type = typdef.rawType;
+ } else {
+ type = new TypedefType(typdef, arguments);
+ }
}
} else if (element.isTypeVariable()) {
if (inStaticContext) {
@@ -1961,7 +1971,7 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
void handleRedirectingFactoryBody(Return node) {
Element redirectionTarget = resolveRedirectingFactory(node);
var type = mapping.getType(node.expression);
- if (type is InterfaceType && !type.typeArguments.isEmpty) {
+ if (type is InterfaceType && !type.isRaw) {
unimplemented(node.expression, 'type arguments on redirecting factory');
}
useElement(node.expression, redirectionTarget);

Powered by Google App Engine
This is Rietveld 408576698