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

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

Powered by Google App Engine
This is Rietveld 408576698