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

Unified Diff: pkg/compiler/lib/src/dart_types.dart

Issue 1969753002: Adjusts dart2js SSA builder to tolerate method type arguments. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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/dart_types.dart
diff --git a/pkg/compiler/lib/src/dart_types.dart b/pkg/compiler/lib/src/dart_types.dart
index 685077d0b6380f328b351f118f8e5157f45b29d2..f106971a5f3143948db7f2236e9652d5a6861225 100644
--- a/pkg/compiler/lib/src/dart_types.dart
+++ b/pkg/compiler/lib/src/dart_types.dart
@@ -234,6 +234,16 @@ class TypeVariableType extends DartType {
String toString() => name;
}
+/// Provides a thin model of method type variables: They are treated as if
+/// their value were `dynamic` when used in a type annotation, and as a
+/// malformed type when used in an `as` or `is` expression.
+class MethodTypeVariableType extends TypeVariableType {
+ MethodTypeVariableType(TypeVariableElement element) : super(element);
+
+ @override
+ bool get treatAsDynamic => true;
+}
+
/// Internal type representing the result of analyzing a statement.
class StatementType extends DartType {
Element get element => null;
@@ -1347,6 +1357,9 @@ class Types implements DartTypes {
static ClassElement getClassContext(DartType type) {
TypeVariableType typeVariable = type.typeVariableOccurrence;
if (typeVariable == null) return null;
+ // TODO(eernst): When generic method support is complete enough to include
+ // a runtime value for method type variables, this may need to be updated.
+ if (typeVariable.element.typeDeclaration is! ClassElement) return null;
return typeVariable.element.typeDeclaration;
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('j') | pkg/compiler/lib/src/ssa/builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698