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