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

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: Rebase with bleeding_edge before commit 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 fb32a1b3a9e561b7deb543506d2c9baf5e26bf04..033359a2b2ef1774e1faa502362960ef2b24f35e 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) {
+ 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