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

Unified Diff: pkg/compiler/lib/src/kernel/element_map_impl.dart

Issue 3010943002: Add ability to look up type parameters that are associated with ClassEntities with the element envi… (Closed)
Patch Set: Created 3 years, 3 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/kernel/element_map_impl.dart
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index a8ac5a068cd334aef4d022906f9140cbd3f6e837..d64b63256cc4edce4bf5a2f816f6d220bf9a870a 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -253,6 +253,11 @@ abstract class KernelToElementMapBase extends KernelToElementMapBaseMixin {
}
}
+ List<DartType> getTypeVariables(ir.Class cls) {
+ return cls.typeParameters
+ .map((ir.TypeParameter type) => getDartType(type.bound));
Johnni Winther 2017/09/04 06:59:56 This is not the correct implementation. class C<T
Emily Fortuna 2017/09/05 17:13:31 Done.
+ }
+
TypeVariableEntity getTypeVariable(ir.TypeParameter node) =>
_getTypeVariable(node);
@@ -1274,6 +1279,16 @@ class KernelElementEnvironment implements ElementEnvironment {
return elementMap._getFieldType(field);
}
+ List<DartType> getTypeVariables(ClassEntity cls) {
+ ir.Class irClass = elementMap._classes.getEnv(cls).cls;
+ // Not all entities have corresponding ir.Nodes, but those that do not are
+ // synthetic elements like closure classes, which don't have specialized
+ // type variables.
+ return irClass == null
+ ? const <DartType>[]
+ : elementMap.getTypeVariables(irClass);
Johnni Winther 2017/09/04 06:59:56 This method can be implemented using the current i
Emily Fortuna 2017/09/05 17:13:31 Done.
+ }
+
@override
FunctionType getLocalFunctionType(covariant KLocalFunction function) {
return function.functionType;

Powered by Google App Engine
This is Rietveld 408576698