Chromium Code Reviews| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 | 384 |
| 385 Scope buildScope(); | 385 Scope buildScope(); |
| 386 | 386 |
| 387 /// If the element is a forwarding constructor, [targetConstructor] holds | 387 /// If the element is a forwarding constructor, [targetConstructor] holds |
| 388 /// the generative constructor that the forwarding constructor points to | 388 /// the generative constructor that the forwarding constructor points to |
| 389 /// (possibly via other forwarding constructors). | 389 /// (possibly via other forwarding constructors). |
| 390 FunctionElement get targetConstructor; | 390 FunctionElement get targetConstructor; |
| 391 | 391 |
| 392 void diagnose(Element context, DiagnosticListener listener); | 392 void diagnose(Element context, DiagnosticListener listener); |
| 393 | 393 |
| 394 // TODO(johnniwinther): Move this to [AstElement]. | |
| 395 /// Returns the [TreeElements] that hold the resolution information for the | |
| 396 /// AST nodes of this element. | |
| 394 TreeElements get treeElements; | 397 TreeElements get treeElements; |
| 395 | 398 |
| 399 // TODO(johnniwinther): Move this to [AstElement]. | |
| 400 /// Returns the [Element] that holds the [TreeElements] for this element. | |
| 401 Element get analyzableElement; | |
|
karlklose
2014/05/22 06:27:29
Perhaps we should have have AstElement extend Anal
Johnni Winther
2014/05/22 10:09:09
Added AnalyzableElement as an interface.
| |
| 402 | |
| 396 accept(ElementVisitor visitor); | 403 accept(ElementVisitor visitor); |
| 397 } | 404 } |
| 398 | 405 |
| 399 class Elements { | 406 class Elements { |
| 400 static bool isUnresolved(Element e) { | 407 static bool isUnresolved(Element e) { |
| 401 return e == null || e.isErroneous; | 408 return e == null || e.isErroneous; |
| 402 } | 409 } |
| 403 static bool isErroneousElement(Element e) => e != null && e.isErroneous; | 410 static bool isErroneousElement(Element e) => e != null && e.isErroneous; |
| 404 | 411 |
| 405 /// Unwraps [element] reporting any warnings attached to it, if any. | 412 /// Unwraps [element] reporting any warnings attached to it, if any. |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1210 } | 1217 } |
| 1211 | 1218 |
| 1212 abstract class MetadataAnnotation implements Spannable { | 1219 abstract class MetadataAnnotation implements Spannable { |
| 1213 /// The front-end constant of this metadata annotation. | 1220 /// The front-end constant of this metadata annotation. |
| 1214 Constant get value; | 1221 Constant get value; |
| 1215 Element get annotatedElement; | 1222 Element get annotatedElement; |
| 1216 int get resolutionState; | 1223 int get resolutionState; |
| 1217 Token get beginToken; | 1224 Token get beginToken; |
| 1218 Token get endToken; | 1225 Token get endToken; |
| 1219 | 1226 |
| 1220 // TODO(kasperl): Try to get rid of these. | |
| 1221 void set annotatedElement(Element value); | |
| 1222 | |
| 1223 MetadataAnnotation ensureResolved(Compiler compiler); | 1227 MetadataAnnotation ensureResolved(Compiler compiler); |
| 1224 } | 1228 } |
| 1225 | 1229 |
| 1226 /// An [Element] that has a type. | 1230 /// An [Element] that has a type. |
| 1227 abstract class TypedElement extends Element { | 1231 abstract class TypedElement extends Element { |
| 1228 DartType get type; | 1232 DartType get type; |
| 1229 } | 1233 } |
| 1230 | 1234 |
| 1231 /// An [Element] that can define a function type. | 1235 /// An [Element] that can define a function type. |
| 1232 abstract class FunctionTypedElement extends Element { | 1236 abstract class FunctionTypedElement extends Element { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1315 bool get isDeclaredByField; | 1319 bool get isDeclaredByField; |
| 1316 | 1320 |
| 1317 /// Returns `true` if this member is abstract. | 1321 /// Returns `true` if this member is abstract. |
| 1318 bool get isAbstract; | 1322 bool get isAbstract; |
| 1319 | 1323 |
| 1320 /// If abstract, [implementation] points to the overridden concrete member, | 1324 /// If abstract, [implementation] points to the overridden concrete member, |
| 1321 /// if any. Otherwise [implementation] points to the member itself. | 1325 /// if any. Otherwise [implementation] points to the member itself. |
| 1322 Member get implementation; | 1326 Member get implementation; |
| 1323 } | 1327 } |
| 1324 | 1328 |
| OLD | NEW |