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

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

Issue 2565413002: Fix rti encoding of generic methods (Closed)
Patch Set: Add comment. Created 4 years 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4482d34a4e2149ccd82bf39b9c8869d639aafaaa..688b43e9adbe2a40a81b18a4698028543633d200 100644
--- a/pkg/compiler/lib/src/dart_types.dart
+++ b/pkg/compiler/lib/src/dart_types.dart
@@ -1434,8 +1434,11 @@ class Types implements DartTypes {
* [type], or [:null:] if [type] does not contain type variables.
*/
static ClassElement getClassContext(DartType type) {
- TypeVariableType typeVariable = type.typeVariableOccurrence;
- if (typeVariable == null) return null;
+ ClassElement contextClass;
+ type.forEachTypeVariable((TypeVariableType typeVariable) {
+ if (typeVariable.element.typeDeclaration is! ClassElement) return;
+ contextClass = typeVariable.element.typeDeclaration;
+ });
// GENERIC_METHODS: When generic method support is complete enough to
// include a runtime value for method type variables this must be updated.
// For full support the global assumption that all type variables are
@@ -1444,8 +1447,7 @@ class Types implements DartTypes {
// type cannot be [ClassElement] and the caller must be prepared to look in
// two locations, not one. Currently we ignore method type variables by
// returning in the next statement.
- if (typeVariable.element.typeDeclaration is! ClassElement) return null;
- return typeVariable.element.typeDeclaration;
+ return contextClass;
}
/**
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698