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]. |
*/ |