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

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

Issue 10869013: Reify partial metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comment 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/scanner/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e56695003d052dd5676e957f771a87408f6164e5..f606062ab159ea3b347085d68ca9d5ac7f70e681 100644
--- a/dart/lib/compiler/implementation/scanner/listener.dart
+++ b/dart/lib/compiler/implementation/scanner/listener.dart
@@ -527,6 +527,8 @@ class ElementListener extends Listener {
Link<Node> nodes = const EmptyLink<Node>();
+ Link<MetadataAnnotation> metadata = const EmptyLink<MetadataAnnotation>();
+
ElementListener(DiagnosticListener listener,
CompilationUnitElement this.compilationUnitElement,
int idGenerator())
@@ -582,8 +584,8 @@ class ElementListener extends Listener {
}
void endMetadata(Token beginToken, Token endToken) {
- var send = popNode(); // Qualified (Send or Identifier).
- // TODO(ahe): Don't discard metadata.
+ popNode(); // Discard node (Send or Identifier).
+ pushMetadata(new PartialMetadataAnnotation(beginToken));
}
void endClassDeclaration(int interfacesCount, Token beginToken,
@@ -809,9 +811,17 @@ class ElementListener extends Listener {
}
void pushElement(Element element) {
+ for (Link link = metadata; !link.isEmpty(); link = link.tail) {
+ element.addMetadata(link.head);
+ }
+ metadata = const EmptyLink<MetadataAnnotation>();
compilationUnitElement.addMember(element, listener);
}
+ void pushMetadata(MetadataAnnotation annotation) {
+ metadata = metadata.prepend(annotation);
+ }
+
void addScriptTag(ScriptTag tag) {
compilationUnitElement.getLibrary().addTag(tag, listener);
}
@@ -1634,7 +1644,7 @@ class PartialMetadataAnnotation extends MetadataAnnotation {
Expression cachedNode;
Constant value;
- PartialMetadataAnnotation(this.value);
+ PartialMetadataAnnotation(this.beginToken);
// TODO(ahe): Add more functionality as needed.
}
« no previous file with comments | « no previous file | dart/lib/compiler/implementation/scanner/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698