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

Side by Side Diff: pkg/compiler/lib/src/elements/elements.dart

Issue 1132783002: Add Accessor, Getter, and Setter elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../tree/tree.dart'; 9 import '../tree/tree.dart';
10 import '../util/util.dart'; 10 import '../util/util.dart';
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 404
405 bool get isSynthesized; 405 bool get isSynthesized;
406 bool get isMixinApplication; 406 bool get isMixinApplication;
407 407
408 bool get hasFixedBackendName; 408 bool get hasFixedBackendName;
409 String get fixedBackendName; 409 String get fixedBackendName;
410 410
411 bool get isAbstract; 411 bool get isAbstract;
412 bool isForeign(Backend backend); 412 bool isForeign(Backend backend);
413 413
414 void addMetadata(MetadataAnnotation annotation);
415 void setNative(String name);
416
417 Scope buildScope(); 414 Scope buildScope();
418 415
419 void diagnose(Element context, DiagnosticListener listener); 416 void diagnose(Element context, DiagnosticListener listener);
420 417
421 // TODO(johnniwinther): Move this to [AstElement]. 418 // TODO(johnniwinther): Move this to [AstElement].
422 /// Returns the [Element] that holds the [TreeElements] for this element. 419 /// Returns the [Element] that holds the [TreeElements] for this element.
423 AnalyzableElement get analyzableElement; 420 AnalyzableElement get analyzableElement;
424 421
425 accept(ElementVisitor visitor, arg); 422 accept(ElementVisitor visitor, arg);
426 } 423 }
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 830
834 // TODO(kasperl): This probably shouldn't be called an element. It's 831 // TODO(kasperl): This probably shouldn't be called an element. It's
835 // just an interface shared by classes and libraries. 832 // just an interface shared by classes and libraries.
836 abstract class ScopeContainerElement implements Element { 833 abstract class ScopeContainerElement implements Element {
837 Element localLookup(String elementName); 834 Element localLookup(String elementName);
838 835
839 void forEachLocalMember(f(Element element)); 836 void forEachLocalMember(f(Element element));
840 } 837 }
841 838
842 abstract class CompilationUnitElement extends Element { 839 abstract class CompilationUnitElement extends Element {
840 /// Use [library] instead.
841 @deprecated
842 get enclosingElement;
843
843 Script get script; 844 Script get script;
844 PartOf get partTag; 845 PartOf get partTag;
845 846
846 void forEachLocalMember(f(Element element)); 847 void forEachLocalMember(f(Element element));
847 void addMember(Element element, DiagnosticListener listener);
848 void setPartOf(PartOf tag, DiagnosticListener listener);
849 bool get hasMembers; 848 bool get hasMembers;
850 849
851 int compareTo(CompilationUnitElement other); 850 int compareTo(CompilationUnitElement other);
852 } 851 }
853 852
854 abstract class LibraryElement extends Element 853 abstract class LibraryElement extends Element
855 implements ScopeContainerElement, AnalyzableElement { 854 implements ScopeContainerElement, AnalyzableElement {
856 /** 855 /**
857 * The canonical uri for this library. 856 * The canonical uri for this library.
858 * 857 *
(...skipping 21 matching lines...) Expand all
880 * [:true:] if this library is from a package, that is, its canonical uri has 879 * [:true:] if this library is from a package, that is, its canonical uri has
881 * the scheme 'package'. 880 * the scheme 'package'.
882 */ 881 */
883 bool get isPackageLibrary; 882 bool get isPackageLibrary;
884 883
885 /** 884 /**
886 * [:true:] if this library is a platform library whose path starts with 885 * [:true:] if this library is a platform library whose path starts with
887 * an underscore. 886 * an underscore.
888 */ 887 */
889 bool get isInternalLibrary; 888 bool get isInternalLibrary;
889
890 bool get canUseNative; 890 bool get canUseNative;
891 bool get exportsHandled; 891 bool get exportsHandled;
892 892
893 // TODO(kasperl): We should try to get rid of these.
894 void set libraryTag(LibraryName value);
895
896 LibraryElement get implementation; 893 LibraryElement get implementation;
897 894
898 void addCompilationUnit(CompilationUnitElement element);
899 void addTag(LibraryTag tag, DiagnosticListener listener);
900 void addImport(Element element, Import import, DiagnosticListener listener);
901
902 /// Record which element an import or export tag resolved to.
903 /// (Belongs on builder object).
904 void recordResolvedTag(LibraryDependency tag, LibraryElement library);
905
906 /// Return the library element corresponding to an import or export. 895 /// Return the library element corresponding to an import or export.
907 LibraryElement getLibraryFromTag(LibraryDependency tag); 896 LibraryElement getLibraryFromTag(LibraryDependency tag);
908 897
909 void addMember(Element element, DiagnosticListener listener);
910 void addToScope(Element element, DiagnosticListener listener);
911
912 // TODO(kasperl): Get rid of this method.
913 Iterable<Element> getNonPrivateElementsInScope();
914
915 void setExports(Iterable<Element> exportedElements);
916
917 Element find(String elementName); 898 Element find(String elementName);
918 Element findLocal(String elementName); 899 Element findLocal(String elementName);
919 Element findExported(String elementName); 900 Element findExported(String elementName);
920 void forEachExport(f(Element element)); 901 void forEachExport(f(Element element));
921 902
922 /// Returns the imports that import element into this library. 903 /// Returns the imports that import element into this library.
923 Link<Import> getImportsFor(Element element); 904 Link<Import> getImportsFor(Element element);
924 905
925 bool hasLibraryName(); 906 bool hasLibraryName();
926 String getLibraryName(); 907 String getLibraryName();
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 abstract class FunctionElement extends Element 1113 abstract class FunctionElement extends Element
1133 implements AstElement, 1114 implements AstElement,
1134 TypedElement, 1115 TypedElement,
1135 FunctionTypedElement, 1116 FunctionTypedElement,
1136 ExecutableElement { 1117 ExecutableElement {
1137 FunctionExpression get node; 1118 FunctionExpression get node;
1138 1119
1139 FunctionElement get patch; 1120 FunctionElement get patch;
1140 FunctionElement get origin; 1121 FunctionElement get origin;
1141 1122
1142 /// Used to retrieve a link to the abstract field element representing this
1143 /// element.
1144 AbstractFieldElement get abstractField;
1145
1146 /// Do not use [computeSignature] outside of the resolver; instead retrieve 1123 /// Do not use [computeSignature] outside of the resolver; instead retrieve
1147 /// the signature through the [functionSignature] field. 1124 /// the signature through the [functionSignature] field.
1148 /// Trying to access a function signature that has not been computed in 1125 /// Trying to access a function signature that has not been computed in
1149 /// resolution is an error and calling [computeSignature] covers that error. 1126 /// resolution is an error and calling [computeSignature] covers that error.
1150 /// This method will go away! 1127 /// This method will go away!
1151 // TODO(johnniwinther): Rename to `ensureFunctionSignature`. 1128 // TODO(johnniwinther): Rename to `ensureFunctionSignature`.
1152 @deprecated FunctionSignature computeSignature(Compiler compiler); 1129 @deprecated FunctionSignature computeSignature(Compiler compiler);
1153 1130
1154 bool get hasFunctionSignature; 1131 bool get hasFunctionSignature;
1155 1132
1156 /// The parameters of this functions. 1133 /// The parameters of this functions.
1157 List<ParameterElement> get parameters; 1134 List<ParameterElement> get parameters;
1158 1135
1159 /// The type of this function. 1136 /// The type of this function.
1160 FunctionType get type; 1137 FunctionType get type;
1161 1138
1162 /// The synchronous/asynchronous marker on this function. 1139 /// The synchronous/asynchronous marker on this function.
1163 AsyncMarker get asyncMarker; 1140 AsyncMarker get asyncMarker;
1164 1141
1165 /// `true` if this function is external. 1142 /// `true` if this function is external.
1166 bool get isExternal; 1143 bool get isExternal;
1167 } 1144 }
1168 1145
1146 /// A getter or setter.
1147 abstract class AccessorElement extends MethodElement {
1148 /// Used to retrieve a link to the abstract field element representing this
1149 /// element.
1150 AbstractFieldElement get abstractField;
1151 }
1152
1153 /// A getter.
1154 abstract class GetterElement extends AccessorElement {
1155 /// The setter corresponding to this getter, if any.
1156 SetterElement get setter;
1157 }
1158
1159 /// A setter.
1160 abstract class SetterElement extends AccessorElement {
1161 /// The getter corresponding to this setter, if any.
1162 GetterElement get getter;
1163 }
1164
1169 /// Enum for the synchronous/asynchronous function body modifiers. 1165 /// Enum for the synchronous/asynchronous function body modifiers.
1170 class AsyncMarker { 1166 class AsyncMarker {
1171 /// The default function body marker. 1167 /// The default function body marker.
1172 static const AsyncMarker SYNC = const AsyncMarker._(); 1168 static const AsyncMarker SYNC = const AsyncMarker._();
1173 1169
1174 /// The `sync*` function body marker. 1170 /// The `sync*` function body marker.
1175 static const AsyncMarker SYNC_STAR = const AsyncMarker._(isYielding: true); 1171 static const AsyncMarker SYNC_STAR = const AsyncMarker._(isYielding: true);
1176 1172
1177 /// The `async` function body marker. 1173 /// The `async` function body marker.
1178 static const AsyncMarker ASYNC = const AsyncMarker._(isAsync: true); 1174 static const AsyncMarker ASYNC = const AsyncMarker._(isAsync: true);
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 bool get isDeclaredByField; 1639 bool get isDeclaredByField;
1644 1640
1645 /// Returns `true` if this member is abstract. 1641 /// Returns `true` if this member is abstract.
1646 bool get isAbstract; 1642 bool get isAbstract;
1647 1643
1648 /// If abstract, [implementation] points to the overridden concrete member, 1644 /// If abstract, [implementation] points to the overridden concrete member,
1649 /// if any. Otherwise [implementation] points to the member itself. 1645 /// if any. Otherwise [implementation] points to the member itself.
1650 Member get implementation; 1646 Member get implementation;
1651 } 1647 }
1652 1648
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698