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

Unified Diff: dart/lib/compiler/implementation/elements/elements.dart

Issue 10870010: Evaluate compile-time constants of metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review commens Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dart/lib/compiler/implementation/patch_parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/lib/compiler/implementation/elements/elements.dart
diff --git a/dart/lib/compiler/implementation/elements/elements.dart b/dart/lib/compiler/implementation/elements/elements.dart
index 2cfa90d06652a110c01bd578db777c881f3c13b1..a8d2fc8cb3dce86ffcc5fb24040b6d5cd99ad10c 100644
--- a/dart/lib/compiler/implementation/elements/elements.dart
+++ b/dart/lib/compiler/implementation/elements/elements.dart
@@ -123,6 +123,8 @@ class Element implements Hashable {
}
void addMetadata(MetadataAnnotation annotation) {
+ assert(annotation.annotatedElement === null);
+ annotation.annotatedElement = this;
metadata = metadata.prepend(annotation);
}
@@ -1599,6 +1601,19 @@ class MetadataAnnotation {
* In the mirror system, this would be an object mirror.
*/
abstract Constant get value();
+ Element annotatedElement;
+ int resolutionState;
+
+ MetadataAnnotation([this.resolutionState = ClassElement.STATE_NOT_STARTED]);
ngeoffray 2012/08/22 21:57:54 Should these constant values be on some other plac
ahe 2012/08/23 05:43:34 Done.
+
+ abstract Node parseNode(DiagnosticListener listener);
+
+ MetadataAnnotation ensureResolved(Compiler compiler) {
+ if (resolutionState == ClassElement.STATE_NOT_STARTED) {
+ compiler.resolver.resolveMetadataAnnotation(this);
+ }
+ return this;
+ }
- // TODO(ahe): Add more functionality as needed.
+ String toString() => 'MetadataAnnotation($value, $resolutionState)';
}
« no previous file with comments | « no previous file | dart/lib/compiler/implementation/patch_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698