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

Unified Diff: dart/lib/compiler/implementation/scanner/listener.dart

Issue 10870010: Evaluate compile-time constants of metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
Index: dart/lib/compiler/implementation/scanner/listener.dart
diff --git a/dart/lib/compiler/implementation/scanner/listener.dart b/dart/lib/compiler/implementation/scanner/listener.dart
index f606062ab159ea3b347085d68ca9d5ac7f70e681..11f7e010ab1ccf275cb158626d2e4cb4b01fd47c 100644
--- a/dart/lib/compiler/implementation/scanner/listener.dart
+++ b/dart/lib/compiler/implementation/scanner/listener.dart
@@ -585,7 +585,8 @@ class ElementListener extends Listener {
void endMetadata(Token beginToken, Token endToken) {
popNode(); // Discard node (Send or Identifier).
- pushMetadata(new PartialMetadataAnnotation(beginToken));
+ pushMetadata(new PartialMetadataAnnotation(compilationUnitElement,
+ beginToken));
Johnni Winther 2012/08/22 13:45:40 Does this always define the scope for the metadata
ahe 2012/08/22 14:01:54 This is what I assume: @foo // Error: foo cannot
Johnni Winther 2012/08/22 14:08:36 But what about: class Foo { static const foo =
ahe 2012/08/22 17:23:02 I assume so.
}
void endClassDeclaration(int interfacesCount, Token beginToken,
@@ -1644,9 +1645,17 @@ class PartialMetadataAnnotation extends MetadataAnnotation {
Expression cachedNode;
Constant value;
- PartialMetadataAnnotation(this.beginToken);
+ PartialMetadataAnnotation(Element enclosingElement, this.beginToken)
+ : super(enclosingElement);
- // TODO(ahe): Add more functionality as needed.
+
+ Node parseNode(DiagnosticListener listener) {
+ if (cachedNode !== null) return cachedNode;
+ cachedNode = parse(listener,
+ enclosingElement,
+ (p) => p.parseSend(beginToken.next));
+ return cachedNode;
+ }
}
Node parse(DiagnosticListener diagnosticListener,

Powered by Google App Engine
This is Rietveld 408576698