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

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/elements.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/elements.dart
diff --git a/sdk/lib/_internal/compiler/implementation/elements/elements.dart b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
index 5dd07122299be26446d4fc6e777e00f208a263c3..b7ab61e44e4aa1f55ca93910da6ca7191450a3d2 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/elements.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
@@ -243,6 +243,9 @@ abstract class Element implements Spannable {
Element get enclosingMember;
Element get outermostEnclosingMemberOrTopLevel;
+ /// The enclosing class that defines the type environment for this element.
+ ClassElement get contextClass;
+
FunctionElement asFunctionElement();
/// Is [:true:] if this element has a corresponding patch.
@@ -899,7 +902,33 @@ abstract class ConstructorBodyElement extends FunctionElement {
* declarations and typedefs.
*/
abstract class TypeDeclarationElement extends Element implements AstElement {
+ /**
+ * The `this type` for this type declaration.
+ *
+ * The type of [:this:] is the generic type based on this element in which
+ * the type arguments are the declared type variables. For instance,
+ * [:List<E>:] for [:List:] and [:Map<K,V>:] for [:Map:].
+ *
+ * For a class declaration this is the type of [:this:].
+ */
GenericType get thisType;
+
+ /**
+ * The raw type for this type declaration.
+ *
+ * The raw type is the generic type base on this element in which the type
+ * arguments are all [dynamic]. For instance [:List<dynamic>:] for [:List:]
+ * and [:Map<dynamic,dynamic>:] for [:Map:]. For non-generic classes [rawType]
+ * is the same as [thisType].
+ *
+ * The [rawType] field is a canonicalization of the raw type and should be
+ * used to distinguish explicit and implicit uses of the [dynamic]
+ * type arguments. For instance should [:List:] be the [rawType] of the
+ * [:List:] class element whereas [:List<dynamic>:] should be its own
+ * instantiation of [InterfaceType] with [:dynamic:] as type argument. Using
+ * this distinction, we can print the raw type with type arguments only when
+ * the input source has used explicit type arguments.
+ */
GenericType get rawType;
/**
@@ -921,12 +950,21 @@ abstract class ClassElement extends TypeDeclarationElement
InterfaceType get rawType;
InterfaceType get thisType;
-
ClassElement get superclass;
+ /// The direct supertype of this class.
DartType get supertype;
+
+ /// Ordered set of all supertypes of this class including the class itself.
OrderedTypeSet get allSupertypesAndSelf;
+
+ /// A list of all supertypes of this class excluding the class itself.
Link<DartType> get allSupertypes;
+
+ /// Returns the this type of this class as an instance of [cls].
+ InterfaceType asInstanceOf(ClassElement cls);
+
+ /// A list of all direct superinterfaces of this class.
Link<DartType> get interfaces;
bool get hasConstructor;

Powered by Google App Engine
This is Rietveld 408576698