Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d2bbb91

Browse files
srawlinscommit-bot@chromium.org
authored andcommitted
Analyzer: Report on more invlid error handlers.
Bug: dart-lang/sdk#35825 Change-Id: I43060e9b0b0a764f14be041c5cbdf1d884d92326 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181740 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent 3a79bae commit d2bbb91

File tree

9 files changed

+999
-439
lines changed

9 files changed

+999
-439
lines changed

pkg/analyzer/lib/error/error.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ const List<ErrorCode> errorCodeValues = [
482482
FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_EXTENDS,
483483
FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS,
484484
FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH,
485-
HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE_CATCH_ERROR_ON_ERROR,
485+
HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE_TO_ERROR_HANDLER,
486486
HintCode.ASSIGNMENT_OF_DO_NOT_STORE,
487487
HintCode.CAN_BE_NULL_AFTER_NULL_AWARE,
488488
HintCode.DEAD_CODE,

pkg/analyzer/lib/src/dart/error/hint_codes.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class HintCode extends AnalyzerErrorCode {
1919
* 0: the name of the actual argument type
2020
* 1: the name of the expected function return type
2121
*/
22-
static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE_CATCH_ERROR_ON_ERROR =
22+
static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE_TO_ERROR_HANDLER =
2323
HintCode(
24-
'ARGUMENT_TYPE_NOT_ASSIGNABLE_CATCH_ERROR_ON_ERROR',
24+
'ARGUMENT_TYPE_NOT_ASSIGNABLE_TO_ERROR_HANDLER',
2525
"The argument type '{0}' can't be assigned to the parameter type "
2626
"'{1} Function(Object)' or '{1} Function(Object, StackTrace)'.");
2727

pkg/analyzer/lib/src/error/best_practices_verifier.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import 'package:analyzer/src/dart/element/type_system.dart';
2323
import 'package:analyzer/src/dart/resolver/body_inference_context.dart';
2424
import 'package:analyzer/src/dart/resolver/exit_detector.dart';
2525
import 'package:analyzer/src/dart/resolver/scope.dart';
26-
import 'package:analyzer/src/error/catch_error_verifier.dart';
2726
import 'package:analyzer/src/error/codes.dart';
2827
import 'package:analyzer/src/error/deprecated_member_use_verifier.dart';
28+
import 'package:analyzer/src/error/error_handler_verifier.dart';
2929
import 'package:analyzer/src/error/must_call_super_verifier.dart';
3030
import 'package:analyzer/src/generated/constant.dart';
3131
import 'package:analyzer/src/generated/engine.dart';
@@ -70,7 +70,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
7070

7171
final MustCallSuperVerifier _mustCallSuperVerifier;
7272

73-
final CatchErrorVerifier _catchErrorVerifier;
73+
final ErrorHandlerVerifier _errorHandlerVerifier;
7474

7575
/// The [WorkspacePackage] in which [_currentLibrary] is declared.
7676
final WorkspacePackage? _workspacePackage;
@@ -109,8 +109,8 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
109109
_deprecatedVerifier =
110110
DeprecatedMemberUseVerifier(workspacePackage, _errorReporter),
111111
_mustCallSuperVerifier = MustCallSuperVerifier(_errorReporter),
112-
_catchErrorVerifier =
113-
CatchErrorVerifier(_errorReporter, typeProvider, typeSystem),
112+
_errorHandlerVerifier =
113+
ErrorHandlerVerifier(_errorReporter, typeProvider, typeSystem),
114114
_workspacePackage = workspacePackage {
115115
_deprecatedVerifier.pushInDeprecatedValue(_currentLibrary.hasDeprecated);
116116
_inDoNotStoreMember = _currentLibrary.hasDoNotStore;
@@ -596,7 +596,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
596596
void visitMethodInvocation(MethodInvocation node) {
597597
_deprecatedVerifier.methodInvocation(node);
598598
_checkForNullAwareHints(node, node.operator);
599-
_catchErrorVerifier.verifyMethodInvocation(node);
599+
_errorHandlerVerifier.verifyMethodInvocation(node);
600600
super.visitMethodInvocation(node);
601601
}
602602

pkg/analyzer/lib/src/error/catch_error_verifier.dart

Lines changed: 0 additions & 150 deletions
This file was deleted.

0 commit comments

Comments
 (0)