| OLD | NEW |
| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 bool isForeign(Compiler compiler); | 379 bool isForeign(Compiler compiler); |
| 380 | 380 |
| 381 void addMetadata(MetadataAnnotation annotation); | 381 void addMetadata(MetadataAnnotation annotation); |
| 382 void setNative(String name); | 382 void setNative(String name); |
| 383 void setFixedBackendName(String name); | 383 void setFixedBackendName(String name); |
| 384 | 384 |
| 385 Scope buildScope(); | 385 Scope buildScope(); |
| 386 | 386 |
| 387 void diagnose(Element context, DiagnosticListener listener); | 387 void diagnose(Element context, DiagnosticListener listener); |
| 388 | 388 |
| 389 // TODO(johnniwinther): Move this to [AstElement]. | 389 TreeElements get treeElements; |
| 390 /// Returns the [Element] that holds the [TreeElements] for this element. | |
| 391 AnalyzableElement get analyzableElement; | |
| 392 | 390 |
| 393 accept(ElementVisitor visitor); | 391 accept(ElementVisitor visitor); |
| 394 } | 392 } |
| 395 | 393 |
| 396 class Elements { | 394 class Elements { |
| 397 static bool isUnresolved(Element e) { | 395 static bool isUnresolved(Element e) { |
| 398 return e == null || e.isErroneous; | 396 return e == null || e.isErroneous; |
| 399 } | 397 } |
| 400 static bool isErroneousElement(Element e) => e != null && e.isErroneous; | 398 static bool isErroneousElement(Element e) => e != null && e.isErroneous; |
| 401 | 399 |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 PartOf get partTag; | 775 PartOf get partTag; |
| 778 | 776 |
| 779 void forEachLocalMember(f(Element element)); | 777 void forEachLocalMember(f(Element element)); |
| 780 void addMember(Element element, DiagnosticListener listener); | 778 void addMember(Element element, DiagnosticListener listener); |
| 781 void setPartOf(PartOf tag, DiagnosticListener listener); | 779 void setPartOf(PartOf tag, DiagnosticListener listener); |
| 782 bool get hasMembers; | 780 bool get hasMembers; |
| 783 | 781 |
| 784 int compareTo(CompilationUnitElement other); | 782 int compareTo(CompilationUnitElement other); |
| 785 } | 783 } |
| 786 | 784 |
| 787 abstract class LibraryElement extends Element | 785 abstract class LibraryElement extends Element implements ScopeContainerElement { |
| 788 implements ScopeContainerElement, AnalyzableElement { | |
| 789 /** | 786 /** |
| 790 * The canonical uri for this library. | 787 * The canonical uri for this library. |
| 791 * | 788 * |
| 792 * For user libraries the canonical uri is the script uri. For platform | 789 * For user libraries the canonical uri is the script uri. For platform |
| 793 * libraries the canonical uri is of the form [:dart:x:]. | 790 * libraries the canonical uri is of the form [:dart:x:]. |
| 794 */ | 791 */ |
| 795 Uri get canonicalUri; | 792 Uri get canonicalUri; |
| 796 CompilationUnitElement get entryCompilationUnit; | 793 CompilationUnitElement get entryCompilationUnit; |
| 797 Link<CompilationUnitElement> get compilationUnits; | 794 Link<CompilationUnitElement> get compilationUnits; |
| 798 Link<LibraryTag> get tags; | 795 Link<LibraryTag> get tags; |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 } | 1219 } |
| 1223 | 1220 |
| 1224 abstract class MetadataAnnotation implements Spannable { | 1221 abstract class MetadataAnnotation implements Spannable { |
| 1225 /// The front-end constant of this metadata annotation. | 1222 /// The front-end constant of this metadata annotation. |
| 1226 Constant get value; | 1223 Constant get value; |
| 1227 Element get annotatedElement; | 1224 Element get annotatedElement; |
| 1228 int get resolutionState; | 1225 int get resolutionState; |
| 1229 Token get beginToken; | 1226 Token get beginToken; |
| 1230 Token get endToken; | 1227 Token get endToken; |
| 1231 | 1228 |
| 1229 // TODO(kasperl): Try to get rid of these. |
| 1230 void set annotatedElement(Element value); |
| 1231 |
| 1232 MetadataAnnotation ensureResolved(Compiler compiler); | 1232 MetadataAnnotation ensureResolved(Compiler compiler); |
| 1233 } | 1233 } |
| 1234 | 1234 |
| 1235 /// An [Element] that has a type. | 1235 /// An [Element] that has a type. |
| 1236 abstract class TypedElement extends Element { | 1236 abstract class TypedElement extends Element { |
| 1237 DartType get type; | 1237 DartType get type; |
| 1238 } | 1238 } |
| 1239 | 1239 |
| 1240 /// An [Element] that can define a function type. | 1240 /// An [Element] that can define a function type. |
| 1241 abstract class FunctionTypedElement extends Element { | 1241 abstract class FunctionTypedElement extends Element { |
| 1242 /// The function signature for the function type defined by this element, | 1242 /// The function signature for the function type defined by this element, |
| 1243 /// if any. | 1243 /// if any. |
| 1244 FunctionSignature get functionSignature; | 1244 FunctionSignature get functionSignature; |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 /// An [Element] that holds a [TreeElements] mapping. | |
| 1248 abstract class AnalyzableElement extends Element { | |
| 1249 /// Returns the [TreeElements] that hold the resolution information for the | |
| 1250 /// AST nodes of this element. | |
| 1251 TreeElements get treeElements; | |
| 1252 } | |
| 1253 | |
| 1254 /// An [Element] that (potentially) has a node. | 1247 /// An [Element] that (potentially) has a node. |
| 1255 /// | 1248 /// |
| 1256 /// Synthesized elements may return `null` from [node]. | 1249 /// Synthesized elements may return `null` from [node]. |
| 1257 abstract class AstElement extends AnalyzableElement { | 1250 abstract class AstElement extends Element { |
| 1258 Node get node; | 1251 Node get node; |
| 1259 } | 1252 } |
| 1260 | 1253 |
| 1261 /// A [MemberSignature] is a member of an interface. | 1254 /// A [MemberSignature] is a member of an interface. |
| 1262 /// | 1255 /// |
| 1263 /// A signature is either a method or a getter or setter, possibly implicitly | 1256 /// A signature is either a method or a getter or setter, possibly implicitly |
| 1264 /// defined by a field declarations. Fields themselves are not members of an | 1257 /// defined by a field declarations. Fields themselves are not members of an |
| 1265 /// interface. | 1258 /// interface. |
| 1266 /// | 1259 /// |
| 1267 /// A [MemberSignature] may be defined by a member declaration or may be | 1260 /// A [MemberSignature] may be defined by a member declaration or may be |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 bool get isDeclaredByField; | 1324 bool get isDeclaredByField; |
| 1332 | 1325 |
| 1333 /// Returns `true` if this member is abstract. | 1326 /// Returns `true` if this member is abstract. |
| 1334 bool get isAbstract; | 1327 bool get isAbstract; |
| 1335 | 1328 |
| 1336 /// If abstract, [implementation] points to the overridden concrete member, | 1329 /// If abstract, [implementation] points to the overridden concrete member, |
| 1337 /// if any. Otherwise [implementation] points to the member itself. | 1330 /// if any. Otherwise [implementation] points to the member itself. |
| 1338 Member get implementation; | 1331 Member get implementation; |
| 1339 } | 1332 } |
| 1340 | 1333 |
| OLD | NEW |