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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/SemanticHighlightings.java

Issue 17586002: Resolve @Type.constructorName() and its arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Resolve @A() - unnamed constructor invocation. Created 7 years, 6 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: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/SemanticHighlightings.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/SemanticHighlightings.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/SemanticHighlightings.java
index be48c85ad023ce1b79a39c776fb9babe57b50e13..49f380de4c80d688efb912afa5d9aa52a440a597 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/SemanticHighlightings.java
+++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/SemanticHighlightings.java
@@ -33,6 +33,7 @@ import com.google.dart.engine.ast.LibraryDirective;
import com.google.dart.engine.ast.MethodDeclaration;
import com.google.dart.engine.ast.PartDirective;
import com.google.dart.engine.ast.PartOfDirective;
+import com.google.dart.engine.ast.PrefixedIdentifier;
import com.google.dart.engine.ast.SimpleIdentifier;
import com.google.dart.engine.ast.StringLiteral;
import com.google.dart.engine.ast.TryStatement;
@@ -83,12 +84,27 @@ public class SemanticHighlightings {
*/
private static class AnnotationHighlighting extends DefaultSemanticHighlighting {
@Override
- public boolean consumesIdentifier(SemanticToken token) {
- SimpleIdentifier node = token.getNodeIdentifier();
- if (node.getParent() instanceof Annotation) {
- Annotation ann = (Annotation) node.getParent();
- return ann.getName() == node;
+ public boolean consumes(SemanticToken token) {
+ ASTNode node = token.getNode();
+ // annotation itself
+ if (node instanceof Annotation) {
+ return true;
+ }
+ // 'Type' or 'Type.name'
+ ASTNode parent = node.getParent();
+ if (parent instanceof Annotation) {
+ Annotation annotation = (Annotation) parent;
+ return annotation.getName() == node;
+ }
+ // 'name' part of 'Type.name'
+ if (parent instanceof PrefixedIdentifier) {
+ ASTNode parent2 = parent.getParent();
+ if (parent2 instanceof Annotation) {
+ Annotation annotation = (Annotation) parent2;
+ return annotation.getName() == parent;
+ }
}
+ // not an annotation
return false;
}

Powered by Google App Engine
This is Rietveld 408576698