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

Unified Diff: pkg/compiler/lib/src/resolution/constructors.dart

Issue 1976213002: Adjusts dart2js backend to handle method type arguments. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Made MethodTypeVariableType malformed, eliminated malformMethodTypeVariableType Created 4 years, 7 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/resolution/constructors.dart
diff --git a/pkg/compiler/lib/src/resolution/constructors.dart b/pkg/compiler/lib/src/resolution/constructors.dart
index 0f9f09920153103d3f6861c9300d7db6d387368e..7819081db35f1e33f25e007068118da6e2063648 100644
--- a/pkg/compiler/lib/src/resolution/constructors.dart
+++ b/pkg/compiler/lib/src/resolution/constructors.dart
@@ -720,8 +720,25 @@ class ConstructorResolver extends CommonResolverVisitor<ConstructorResult> {
{PrefixElement prefix}) {
String name = type.name;
if (type.isMalformed) {
Johnni Winther 2016/05/23 12:50:41 If you move `if (type.isTypeVariable) ...` before
eernst 2016/05/23 14:30:24 Done.
- return new ConstructorResult.forError(
- ConstructorResultKind.INVALID_TYPE, type.element, type);
+ if (type is MalformedType) {
+ return new ConstructorResult.forError(
+ ConstructorResultKind.INVALID_TYPE, type.element, type);
+ } else {
+ // GENERIC_METHODS: This block provides thin support for generic
+ // methods: If a method type variable is used as a constructor, a
+ // warning is issued and code for a runtime error generated.
+ assert(type is MethodTypeVariableType);
+ MethodTypeVariableType methodTypeVariableType = type;
+ reporter.reportWarningMessage(
+ node,
+ MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE,
+ { 'typeVariableName': methodTypeVariableType.name});
+ registry.registerFeature(Feature.THROW_RUNTIME_ERROR);
+ return new ConstructorResult.forError(
+ ConstructorResultKind.INVALID_TYPE,
+ methodTypeVariableType.toMalformedElement,
+ methodTypeVariableType);
+ }
} else if (type.isInterfaceType) {
return new ConstructorResult.forType(prefix, type);
} else if (type.isTypedef) {

Powered by Google App Engine
This is Rietveld 408576698