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

Unified Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 2990723002: Revert "Implemented support for generalized void in analyzer." (Closed)
Patch Set: Created 3 years, 5 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 | « pkg/analyzer/lib/src/error/codes.dart ('k') | pkg/analyzer/lib/src/generated/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/error_verifier.dart
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 4660299dcd3ca2e7f282454ef644d7b559905ae6..50513f74be7c9b4b34d9a864b80799d318001ad6 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -962,6 +962,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
_checkForMismatchedAccessorTypes(node, methodName);
}
if (node.isGetter) {
+ _checkForVoidReturnType(node);
_checkForConflictingStaticGetterAndInstanceSetter(node);
} else if (node.isSetter) {
_checkForInvalidModifierOnBody(
@@ -6039,6 +6040,19 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
// }
}
+ /**
+ * Verify that the given [getter] does not have a return type of 'void'.
+ *
+ * See [StaticWarningCode.VOID_RETURN_FOR_GETTER].
+ */
+ void _checkForVoidReturnType(MethodDeclaration getter) {
+ TypeAnnotation returnType = getter.returnType;
+ if (returnType is TypeName && returnType.name.name == "void") {
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.VOID_RETURN_FOR_GETTER, returnType);
+ }
+ }
+
/**
* Verify the given operator-method [declaration], has correct number of
* parameters.
« no previous file with comments | « pkg/analyzer/lib/src/error/codes.dart ('k') | pkg/analyzer/lib/src/generated/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698