Chromium Code Reviews| 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 4a5ffb7e3a9c9c97c3ad625166ad4563de32c19f..2ea79f7f519c24e6a346024de611151cfa3e1d8e 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart |
| @@ -260,6 +260,16 @@ abstract class ElementX implements Element { |
| return null; |
| } |
| + ClassElement get contextClass { |
| + ClassElement cls; |
| + for (Element e = this; e != null; e = e.enclosingElement) { |
| + if (e.isClass()) { |
| + cls = e.declaration; |
|
karlklose
2014/05/07 12:46:37
Break or return value here?
Johnni Winther
2014/05/08 07:03:59
No. We need the last class -- the first might be a
|
| + } |
| + } |
| + return cls; |
| + } |
| + |
| /** |
| * Creates the scope for this element. |
| */ |
| @@ -1976,6 +1986,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]. |
| */ |