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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java

Issue 258393003: Further work on 17522 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
index b3782475bf5e308a83d5e269e2710c91de74468f..ec4d2067f8eb8a6e3a14d0da7742d207335ad02e 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
@@ -461,6 +461,12 @@ public class ErrorVerifier extends RecursiveAstVisitor<Void> {
}
@Override
+ public Void visitAnnotation(Annotation node) {
+ checkForInvalidAnnotationFromDeferredLibrary(node);
+ return super.visitAnnotation(node);
+ }
+
+ @Override
public Void visitArgumentList(ArgumentList node) {
checkForArgumentTypesNotAssignableInList(node);
return super.visitArgumentList(node);
@@ -1111,6 +1117,15 @@ public class ErrorVerifier extends RecursiveAstVisitor<Void> {
}
@Override
+ public Void visitTypeArgumentList(TypeArgumentList node) {
+ NodeList<TypeName> list = node.getArguments();
+ for (TypeName typeName : list) {
+ checkForTypeAnnotationDeferredClass(typeName);
+ }
+ return super.visitTypeArgumentList(node);
+ }
+
+ @Override
public Void visitTypeName(TypeName node) {
checkForTypeArgumentNotMatchingBounds(node);
checkForTypeParameterReferencedByStatic(node);
@@ -3782,6 +3797,26 @@ public class ErrorVerifier extends RecursiveAstVisitor<Void> {
}
/**
+ * This verifies that the passed {@link Annotation} isn't defined in a deferred library.
+ *
+ * @param node the {@link Annotation}
+ * @return {@code true} if and only if an error code is generated on the passed node
+ * @see CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY
+ */
+ private boolean checkForInvalidAnnotationFromDeferredLibrary(Annotation node) {
+ Identifier nameIdentifier = node.getName();
+ if (nameIdentifier instanceof PrefixedIdentifier) {
Brian Wilkerson 2014/04/29 23:01:52 Does this cover the constructor case ("@prefix.Cla
jwren 2014/04/30 22:42:14 It is covered, but it isn't obvious by looking at
+ if (((PrefixedIdentifier) nameIdentifier).isDeferred()) {
+ errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY,
+ node.getName());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* This verifies that the passed left hand side and right hand side represent a valid assignment.
*
* @param lhs the left hand side expression

Powered by Google App Engine
This is Rietveld 408576698