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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library elements; 5 library elements;
6 6
7 7
8 import '../tree/tree.dart'; 8 import '../tree/tree.dart';
9 import '../util/util.dart'; 9 import '../util/util.dart';
10 import '../resolution/resolution.dart'; 10 import '../resolution/resolution.dart';
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 Token position(); 238 Token position();
239 239
240 CompilationUnitElement getCompilationUnit(); 240 CompilationUnitElement getCompilationUnit();
241 LibraryElement getLibrary(); 241 LibraryElement getLibrary();
242 LibraryElement getImplementationLibrary(); 242 LibraryElement getImplementationLibrary();
243 ClassElement getEnclosingClass(); 243 ClassElement getEnclosingClass();
244 Element getEnclosingClassOrCompilationUnit(); 244 Element getEnclosingClassOrCompilationUnit();
245 Element getEnclosingMember(); 245 Element getEnclosingMember();
246 Element getOutermostEnclosingMemberOrTopLevel(); 246 Element getOutermostEnclosingMemberOrTopLevel();
247 247
248 /// The enclosing class that defines the type environment for this element.
249 ClassElement get contextClass;
250
248 FunctionElement asFunctionElement(); 251 FunctionElement asFunctionElement();
249 252
250 bool get isPatched; 253 bool get isPatched;
251 bool get isPatch; 254 bool get isPatch;
252 bool get isImplementation; 255 bool get isImplementation;
253 bool get isDeclaration; 256 bool get isDeclaration;
254 bool get isSynthesized; 257 bool get isSynthesized;
255 bool get isForwardingConstructor; 258 bool get isForwardingConstructor;
256 bool get isMixinApplication; 259 bool get isMixinApplication;
257 260
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 861
859 abstract class ConstructorBodyElement extends FunctionElement { 862 abstract class ConstructorBodyElement extends FunctionElement {
860 FunctionElement get constructor; 863 FunctionElement get constructor;
861 } 864 }
862 865
863 /** 866 /**
864 * [TypeDeclarationElement] defines the common interface for class/interface 867 * [TypeDeclarationElement] defines the common interface for class/interface
865 * declarations and typedefs. 868 * declarations and typedefs.
866 */ 869 */
867 abstract class TypeDeclarationElement extends Element { 870 abstract class TypeDeclarationElement extends Element {
871 /**
872 * The `this type` for this type declaration.
873 *
874 * The type of [:this:] is the generic type based on this element in which
875 * the type arguments are the declared type variables. For instance,
876 * [:List<E>:] for [:List:] and [:Map<K,V>:] for [:Map:].
877 *
878 * For a class declaration this is the type of [:this:].
879 */
868 GenericType get thisType; 880 GenericType get thisType;
881
882 /**
883 * The raw type for this type declaration.
884 *
885 * The raw type is the generic type base on this element in which the type
886 * arguments are all [dynamic]. For instance [:List<dynamic>:] for [:List:]
887 * and [:Map<dynamic,dynamic>:] for [:Map:]. For non-generic classes [rawType]
888 * is the same as [thisType].
889 *
890 * The [rawType] field is a canonicalization of the raw type and should be
891 * used to distinguish explicit and implicit uses of the [dynamic]
892 * type arguments. For instance should [:List:] be the [rawType] of the
893 * [:List:] class element whereas [:List<dynamic>:] should be its own
894 * instantiation of [InterfaceType] with [:dynamic:] as type argument. Using
895 * this distinction, we can print the raw type with type arguments only when
896 * the input source has used explicit type arguments.
897 */
869 GenericType get rawType; 898 GenericType get rawType;
870 899
871 /** 900 /**
872 * The type variables declared on this declaration. The type variables are not 901 * The type variables declared on this declaration. The type variables are not
873 * available until the type of the element has been computed through 902 * available until the type of the element has been computed through
874 * [computeType]. 903 * [computeType].
875 */ 904 */
876 Link<DartType> get typeVariables; 905 Link<DartType> get typeVariables;
877 906
878 bool get isResolved; 907 bool get isResolved;
879 } 908 }
880 909
881 abstract class ClassElement extends TypeDeclarationElement 910 abstract class ClassElement extends TypeDeclarationElement
882 implements ScopeContainerElement { 911 implements ScopeContainerElement {
883 int get id; 912 int get id;
884 913
885 /// The length of the longest inheritance path from [:Object:]. 914 /// The length of the longest inheritance path from [:Object:].
886 int get hierarchyDepth; 915 int get hierarchyDepth;
887 916
888 InterfaceType get rawType; 917 InterfaceType get rawType;
889 InterfaceType get thisType; 918 InterfaceType get thisType;
890
891 ClassElement get superclass; 919 ClassElement get superclass;
892 920
921 /// The direct supertype of this class.
893 DartType get supertype; 922 DartType get supertype;
923
924 /// Ordered set of all supertypes of this class.
894 OrderedTypeSet get allSupertypesAndSelf; 925 OrderedTypeSet get allSupertypesAndSelf;
926
927 /// A list of all
karlklose 2014/05/07 12:46:37 Comment is incomplete.
Johnni Winther 2014/05/08 07:03:59 Done.
895 Link<DartType> get allSupertypes; 928 Link<DartType> get allSupertypes;
929
930 /// Returns the this type of this class as an instance of [cls]:
karlklose 2014/05/07 12:46:37 Is there missing something? If not, terminate with
Johnni Winther 2014/05/08 07:03:59 Done.
931 InterfaceType asInstanceOf(ClassElement cls);
932
933 /// A list of all direct superinterfaces of this class.
896 Link<DartType> get interfaces; 934 Link<DartType> get interfaces;
897 935
898 bool get hasConstructor; 936 bool get hasConstructor;
899 Link<Element> get constructors; 937 Link<Element> get constructors;
900 938
901 ClassElement get patch; 939 ClassElement get patch;
902 ClassElement get origin; 940 ClassElement get origin;
903 ClassElement get declaration; 941 ClassElement get declaration;
904 ClassElement get implementation; 942 ClassElement get implementation;
905 943
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 bool get isDeclaredByField; 1176 bool get isDeclaredByField;
1139 1177
1140 /// Returns `true` if this member is abstract. 1178 /// Returns `true` if this member is abstract.
1141 bool get isAbstract; 1179 bool get isAbstract;
1142 1180
1143 /// If abstract, [implementation] points to the overridden concrete member, 1181 /// If abstract, [implementation] points to the overridden concrete member,
1144 /// if any. Otherwise [implementation] points to the member itself. 1182 /// if any. Otherwise [implementation] points to the member itself.
1145 Member get implementation; 1183 Member get implementation;
1146 } 1184 }
1147 1185
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698