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

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

Issue 11348294: Follow-up to https://chromiumcodereview.appspot.com/11416144/. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed dart2dart malformed type handling in visitNewExpression(). Fixed comments. 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 9e1e01859bf7060e6ed1ec4c7da2d56d676a1fc5..10443ee39dbed748623d470145ef15d7855da59a 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -1038,7 +1038,7 @@ class TypeResolver {
TypeResolver(this.compiler);
- bool anyMalformedTypesInThere(Link<DartType> list) {
+ bool anyMalformedTypes(Link<DartType> list) {
for (Link<DartType> link = list;
!link.isEmpty;
link = link.tail) {
@@ -1136,11 +1136,23 @@ class TypeResolver {
// Use the canonical type if it has no type parameters.
type = cls.computeType(compiler);
} else {
- // In checked mode malformed-ness of the type argument bubbles up.
- if (anyMalformedTypesInThere(arguments) &&
- compiler.enableTypeAssertions) {
- type = new MalformedType(
- new MalformedTypeElement(node, element));
+ if (anyMalformedTypes(arguments)) {
+ // Build interface type (with malformed arguments in it) and
+ // call [whenResolved] to let [ConstructorResolver] create
+ // constructor selectors, which are used by
+ // [SsaBuilder.visitNewSend] to figure out what class needs
+ // to be built.
+ whenResolved(node,
+ new InterfaceType(cls.declaration, arguments));
+ // Return malformed type element below so that
+ // [ConstructorResolver.visitTypeAnnotation] gets [:MalformedType:]
+ // and can map (via resolver.mapping) NewExpression node to
+ // this malformed type.
+ // [SsaBuilder.visitNewExpression] picks up the fact that
+ // NewExpression is mapped to malformed type and generates
+ // runtime error in checked mode.
+ type = new MalformedType(new MalformedTypeElement(node, element));
+ return type;
} else {
if (arguments.isEmpty) {
// Use the canonical raw type if the class is generic.

Powered by Google App Engine
This is Rietveld 408576698