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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/elements/elements.dart

Issue 137893024: Revert "Reapply "Implement new model for class members." and "Implement new model for interface mem… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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';
11 11
12 import '../dart2jslib.dart' show InterfaceType, 12 import '../dart2jslib.dart' show InterfaceType,
13 DartType, 13 DartType,
14 TypeVariableType, 14 TypeVariableType,
15 TypedefType, 15 TypedefType,
16 DualKind, 16 DualKind,
17 MessageKind, 17 MessageKind,
18 DiagnosticListener, 18 DiagnosticListener,
19 Script, 19 Script,
20 FunctionType, 20 FunctionType,
21 Selector, 21 Selector,
22 Constant, 22 Constant,
23 Compiler, 23 Compiler;
24 isPrivateName;
25 24
26 import '../dart_types.dart'; 25 import '../dart_types.dart';
27 26
28 import '../scanner/scannerlib.dart' show Token, 27 import '../scanner/scannerlib.dart' show Token,
29 isUserDefinableOperator, 28 isUserDefinableOperator,
30 isMinusOperator; 29 isMinusOperator;
31 30
32 import '../ordered_typeset.dart' show OrderedTypeSet; 31 import '../ordered_typeset.dart' show OrderedTypeSet;
33 32
34 import 'visitor.dart' show ElementVisitor; 33 import 'visitor.dart' show ElementVisitor;
35 34
36 part 'names.dart';
37
38 const int STATE_NOT_STARTED = 0; 35 const int STATE_NOT_STARTED = 0;
39 const int STATE_STARTED = 1; 36 const int STATE_STARTED = 1;
40 const int STATE_DONE = 2; 37 const int STATE_DONE = 2;
41 38
42 class ElementCategory { 39 class ElementCategory {
43 /** 40 /**
44 * Represents things that we don't expect to find when looking in a 41 * Represents things that we don't expect to find when looking in a
45 * scope. 42 * scope.
46 */ 43 */
47 static const int NONE = 0; 44 static const int NONE = 0;
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 void set nativeTagInfo(String value); 899 void set nativeTagInfo(String value);
903 900
904 bool isObject(Compiler compiler); 901 bool isObject(Compiler compiler);
905 bool isSubclassOf(ClassElement cls); 902 bool isSubclassOf(ClassElement cls);
906 bool implementsInterface(ClassElement intrface); 903 bool implementsInterface(ClassElement intrface);
907 bool hasFieldShadowedBy(Element fieldMember); 904 bool hasFieldShadowedBy(Element fieldMember);
908 905
909 /// Returns `true` if this class has a @proxy annotation. 906 /// Returns `true` if this class has a @proxy annotation.
910 bool get isProxy; 907 bool get isProxy;
911 908
912 /// Returns `true` if the class hierarchy for this class contains errors.
913 bool get hasIncompleteHierarchy;
914
915 ClassElement ensureResolved(Compiler compiler); 909 ClassElement ensureResolved(Compiler compiler);
916 910
917 void addMember(Element element, DiagnosticListener listener); 911 void addMember(Element element, DiagnosticListener listener);
918 void addToScope(Element element, DiagnosticListener listener); 912 void addToScope(Element element, DiagnosticListener listener);
919 913
920 void setDefaultConstructor(FunctionElement constructor, Compiler compiler); 914 void setDefaultConstructor(FunctionElement constructor, Compiler compiler);
921 915
922 void addBackendMember(Element element); 916 void addBackendMember(Element element);
923 void reverseBackendMembers(); 917 void reverseBackendMembers();
924 918
(...skipping 21 matching lines...) Expand all
946 void forEachInstanceField(void f(ClassElement enclosingClass, 940 void forEachInstanceField(void f(ClassElement enclosingClass,
947 FieldElement field), 941 FieldElement field),
948 {bool includeSuperAndInjectedMembers: false}); 942 {bool includeSuperAndInjectedMembers: false});
949 943
950 /// Similar to [forEachInstanceField] but visits static fields. 944 /// Similar to [forEachInstanceField] but visits static fields.
951 void forEachStaticField(void f(ClassElement enclosingClass, Element field)); 945 void forEachStaticField(void f(ClassElement enclosingClass, Element field));
952 946
953 void forEachBackendMember(void f(Element member)); 947 void forEachBackendMember(void f(Element member));
954 948
955 Link<DartType> computeTypeParameters(Compiler compiler); 949 Link<DartType> computeTypeParameters(Compiler compiler);
956
957 /// Looks up the member [name] in this class.
958 Member lookupClassMember(Name name);
959
960 /// Calls [f] with each member of this class.
961 void forEachClassMember(f(Member member));
962
963 /// Looks up the member [name] in the interface of this class.
964 MemberSignature lookupInterfaceMember(Name name);
965
966 /// Calls [f] with each member of the interface of this class.
967 void forEachInterfaceMember(f(MemberSignature member));
968 } 950 }
969 951
970 abstract class MixinApplicationElement extends ClassElement { 952 abstract class MixinApplicationElement extends ClassElement {
971 ClassElement get mixin; 953 ClassElement get mixin;
972 InterfaceType get mixinType; 954 InterfaceType get mixinType;
973 void set mixinType(InterfaceType value); 955 void set mixinType(InterfaceType value);
974 void addConstructor(FunctionElement constructor); 956 void addConstructor(FunctionElement constructor);
975 } 957 }
976 958
977 abstract class LabelElement extends Element { 959 abstract class LabelElement extends Element {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 Token get endToken; 1003 Token get endToken;
1022 1004
1023 // TODO(kasperl): Try to get rid of these. 1005 // TODO(kasperl): Try to get rid of these.
1024 void set annotatedElement(Element value); 1006 void set annotatedElement(Element value);
1025 void set resolutionState(int value); 1007 void set resolutionState(int value);
1026 1008
1027 MetadataAnnotation ensureResolved(Compiler compiler); 1009 MetadataAnnotation ensureResolved(Compiler compiler);
1028 } 1010 }
1029 1011
1030 abstract class VoidElement extends Element {} 1012 abstract class VoidElement extends Element {}
1031
1032 /// A [MemberSignature] is a member of an interface.
1033 ///
1034 /// A signature is either a method or a getter or setter, possibly implicitly
1035 /// defined by a field declarations. Fields themselves are not members of an
1036 /// interface.
1037 ///
1038 /// A [MemberSignature] may be defined by a member declaration or may be
1039 /// synthetized from a set of declarations.
1040 abstract class MemberSignature {
1041 /// The name of this member.
1042 Name get name;
1043
1044 /// The type of the member when accessed. For getters and setters this is the
1045 /// return type and argument type, respectively. For methods the type is the
1046 /// [functionType] defined by the return type and parameters.
1047 DartType get type;
1048
1049 /// The function type of the member. For a getter `Foo get foo` this is
1050 /// `() -> Foo`, for a setter `void set foo(Foo _)` this is `(Foo) -> void`.
1051 /// For methods the function type is defined by the return type and
1052 /// parameters.
1053 FunctionType get functionType;
1054
1055 /// Returns `true` if this member is a getter, possibly implictly defined by a
1056 /// field declaration.
1057 bool get isGetter;
1058
1059 /// Returns `true` if this member is a setter, possibly implictly defined by a
1060 /// field declaration.
1061 bool get isSetter;
1062
1063 /// Returns `true` if this member is a method, that is neither a getter nor
1064 /// setter.
1065 bool get isMethod;
1066
1067 /// Returns an iterable of the declarations that define this member.
1068 Iterable<Member> get declarations;
1069 }
1070
1071 /// A [Member] is a member of a class, that is either a method or a getter or
1072 /// setter, possibly implicitly defined by a field declarations. Fields
1073 /// themselves are not members of a class.
1074 ///
1075 /// A [Member] of a class also defines a signature which is a member of the
1076 /// corresponding interface type.
1077 ///
1078 /// A [Member] is implicitly concrete. An abstract declaration only declares
1079 /// a signature in the interface of its class.
1080 ///
1081 /// A [Member] is always declared by an [Element] which is accessibly through
1082 /// the [element] getter.
1083 abstract class Member extends MemberSignature {
1084 /// The [Element] that declared this member, possibly implicitly in case of
1085 /// a getter or setter defined by a field.
1086 Element get element;
1087
1088 /// The instance of the class that declared this member.
1089 ///
1090 /// For instance:
1091 /// class A<T> { T m() {} }
1092 /// class B<S> extends A<S> {}
1093 /// The declarer of `m` in `A` is `A<T>` whereas the declarer of `m` in `B` is
1094 /// `A<S>`.
1095 InterfaceType get declarer;
1096
1097 /// Returns `true` if this member is static.
1098 bool get isStatic;
1099
1100 /// Returns `true` if this member is a getter or setter implicitly declared
1101 /// by a field.
1102 bool get isDeclaredByField;
1103 }
1104
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698