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

Side by Side 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, 4 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.generated.error_verifier; 5 library analyzer.src.generated.error_verifier;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 SimpleIdentifier identifier = node.name; 955 SimpleIdentifier identifier = node.name;
956 String methodName = ""; 956 String methodName = "";
957 if (identifier != null) { 957 if (identifier != null) {
958 methodName = identifier.name; 958 methodName = identifier.name;
959 } 959 }
960 TypeAnnotation returnType = node.returnType; 960 TypeAnnotation returnType = node.returnType;
961 if (node.isSetter || node.isGetter) { 961 if (node.isSetter || node.isGetter) {
962 _checkForMismatchedAccessorTypes(node, methodName); 962 _checkForMismatchedAccessorTypes(node, methodName);
963 } 963 }
964 if (node.isGetter) { 964 if (node.isGetter) {
965 _checkForVoidReturnType(node);
965 _checkForConflictingStaticGetterAndInstanceSetter(node); 966 _checkForConflictingStaticGetterAndInstanceSetter(node);
966 } else if (node.isSetter) { 967 } else if (node.isSetter) {
967 _checkForInvalidModifierOnBody( 968 _checkForInvalidModifierOnBody(
968 node.body, CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER); 969 node.body, CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER);
969 _checkForWrongNumberOfParametersForSetter(node.name, node.parameters); 970 _checkForWrongNumberOfParametersForSetter(node.name, node.parameters);
970 _checkForNonVoidReturnTypeForSetter(returnType); 971 _checkForNonVoidReturnTypeForSetter(returnType);
971 _checkForConflictingStaticSetterAndInstanceMember(node); 972 _checkForConflictingStaticSetterAndInstanceMember(node);
972 } else if (node.isOperator) { 973 } else if (node.isOperator) {
973 _checkForOptionalParameterInOperator(node); 974 _checkForOptionalParameterInOperator(node);
974 _checkForWrongNumberOfParametersForOperator(node); 975 _checkForWrongNumberOfParametersForOperator(node);
(...skipping 5058 matching lines...) Expand 10 before | Expand all | Expand 10 after
6033 } 6034 }
6034 } 6035 }
6035 } 6036 }
6036 // else { 6037 // else {
6037 // // TODO(jwren) Report error, constructor initializer variable is a top level element 6038 // // TODO(jwren) Report error, constructor initializer variable is a top level element
6038 // // (Either here or in ErrorVerifier.checkForAllFinalInitializedErrorCo des) 6039 // // (Either here or in ErrorVerifier.checkForAllFinalInitializedErrorCo des)
6039 // } 6040 // }
6040 } 6041 }
6041 6042
6042 /** 6043 /**
6044 * Verify that the given [getter] does not have a return type of 'void'.
6045 *
6046 * See [StaticWarningCode.VOID_RETURN_FOR_GETTER].
6047 */
6048 void _checkForVoidReturnType(MethodDeclaration getter) {
6049 TypeAnnotation returnType = getter.returnType;
6050 if (returnType is TypeName && returnType.name.name == "void") {
6051 _errorReporter.reportErrorForNode(
6052 StaticWarningCode.VOID_RETURN_FOR_GETTER, returnType);
6053 }
6054 }
6055
6056 /**
6043 * Verify the given operator-method [declaration], has correct number of 6057 * Verify the given operator-method [declaration], has correct number of
6044 * parameters. 6058 * parameters.
6045 * 6059 *
6046 * This method assumes that the method declaration was tested to be an 6060 * This method assumes that the method declaration was tested to be an
6047 * operator declaration before being called. 6061 * operator declaration before being called.
6048 * 6062 *
6049 * See [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]. 6063 * See [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR].
6050 */ 6064 */
6051 void _checkForWrongNumberOfParametersForOperator( 6065 void _checkForWrongNumberOfParametersForOperator(
6052 MethodDeclaration declaration) { 6066 MethodDeclaration declaration) {
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
7144 class _InvocationCollector extends RecursiveAstVisitor { 7158 class _InvocationCollector extends RecursiveAstVisitor {
7145 final List<String> superCalls = <String>[]; 7159 final List<String> superCalls = <String>[];
7146 7160
7147 @override 7161 @override
7148 visitMethodInvocation(MethodInvocation node) { 7162 visitMethodInvocation(MethodInvocation node) {
7149 if (node.target is SuperExpression) { 7163 if (node.target is SuperExpression) {
7150 superCalls.add(node.methodName.name); 7164 superCalls.add(node.methodName.name);
7151 } 7165 }
7152 } 7166 }
7153 } 7167 }
OLDNEW
« 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