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

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 267153002: Support general handling of type variables by substituting types into the current context. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased + reinserted unalias Created 6 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: sdk/lib/_internal/compiler/implementation/elements/modelx.dart
diff --git a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
index 11eeb0106458a65e0ba8ee8d745ee91b78dbbde4..57b257c931869cd384bb8aa6b34efe31f71b998b 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -225,6 +225,18 @@ abstract class ElementX implements Element {
return null;
}
+ ClassElement get contextClass {
+ ClassElement cls;
+ for (Element e = this; e != null; e = e.enclosingElement) {
+ if (e.isClass) {
+ // Record [e] instead of returning it directly. We need the last class
+ // in the chain since the first classes might be closure classes.
+ cls = e.declaration;
+ }
+ }
+ return cls;
+ }
+
/**
* Creates the scope for this element.
*/
@@ -1917,6 +1929,11 @@ abstract class BaseClassElementX extends ElementX
Link<DartType> computeTypeParameters(Compiler compiler);
+ InterfaceType asInstanceOf(ClassElement cls) {
+ if (cls == this) return thisType;
+ return allSupertypesAndSelf.asInstanceOf(cls);
+ }
+
/**
* Return [:true:] if this element is the [:Object:] class for the [compiler].
*/

Powered by Google App Engine
This is Rietveld 408576698