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

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

Issue 11293244: Implement --analyze-all option. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Correctly parse metadata Created 8 years, 1 month 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/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart b/dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
index ae3453b7986bf1095902d3ae0a50fcf8c2f1d4ca..f4d8be4ca8f8eea05b7cb8e2e4ed9adf1c6247fe 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
@@ -254,7 +254,7 @@ class Listener {
void beginMetadata(Token token) {
}
- void endMetadata(Token beginToken, Token endToken) {
+ void endMetadata(Token beginToken, Token periodBeforeName, Token endToken) {
}
void beginOptionalFormalParameters(Token token) {
@@ -735,7 +735,10 @@ class ElementListener extends Listener {
}
}
- void endMetadata(Token beginToken, Token endToken) {
+ void endMetadata(Token beginToken, Token periodBeforeName, Token endToken) {
+ if (periodBeforeName != null) {
+ popNode(); // Discard name.
+ }
popNode(); // Discard node (Send or Identifier).
pushMetadata(new PartialMetadataAnnotation(beginToken));
}
@@ -1722,6 +1725,42 @@ class NodeListener extends ElementListener {
beginToken, inKeyword));
}
+ void endMetadata(Token beginToken, Token periodBeforeName, Token endToken) {
+ NodeList arguments = popNode();
+ if (arguments == null) {
+ // This is a constant expression.
+ Identifier name;
+ if (periodBeforeName != null) {
+ name = popNode();
+ }
+ NodeList typeArguments = popNode();
+ Node receiver = popNode();
+ if (typeArguments != null) {
+ receiver = new TypeAnnotation(receiver, typeArguments);
+ recoverableError('typeArguments not allowed here', node: typeArguments);
sra1 2012/11/13 18:56:40 If this is a user-facing message, replace typeArgu
ahe 2012/11/14 17:56:21 Done in r14889.
+ } else {
+ Identifier identifier = receiver.asIdentifier();
+ Send send = receiver.asSend();
+ if (identifier != null) {
+ receiver = new Send(null, identifier);
+ } else if (send == null) {
+ internalError(node: receiver);
+ }
+ }
+ Send send = receiver;
+ if (name != null) {
+ send = new Send(receiver, name);
+ }
+ pushNode(send);
+ } else {
+ // This is a const constructor call.
+ endConstructorReference(beginToken, periodBeforeName, endToken);
+ Node constructor = popNode();
+ pushNode(new NewExpression(beginToken,
+ new Send(null, constructor, arguments)));
+ }
+ }
+
void handleAssertStatement(Token assertKeyword, Token semicolonToken) {
NodeList arguments = popNode();
Node selector = new Identifier(assertKeyword);
@@ -1892,7 +1931,7 @@ class PartialMetadataAnnotation extends MetadataAnnotation {
if (cachedNode != null) return cachedNode;
cachedNode = parse(listener,
annotatedElement.getCompilationUnit(),
- (p) => p.parseSend(beginToken.next));
+ (p) => p.parseMetadata(beginToken));
return cachedNode;
}
}

Powered by Google App Engine
This is Rietveld 408576698