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

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

Issue 2813553006: Split error code to ease future improvements (Closed)
Patch Set: Created 3 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: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index d3dbd3d3fde2f25c710476f740488e67670e69f2..d6e8567944d1db1a5597fe8e6ed37ac7cf0ecd80 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -7157,9 +7157,18 @@ class ResolverVisitor extends ScopedVisitor {
}
} else if (positionalArgumentCount > unnamedParameterCount &&
noBlankArguments) {
- ErrorCode errorCode = (reportAsError
- ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS
- : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS);
+ ErrorCode errorCode;
+ int namedParameterCount = namedParameters?.length ?? 0;
+ int namedArgumentCount = usedNames?.length ?? 0;
+ if (namedParameterCount > namedArgumentCount) {
+ errorCode = (reportAsError
+ ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED
+ : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED);
+ } else {
+ errorCode = (reportAsError
+ ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS
+ : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS);
+ }
if (onError != null) {
onError(errorCode, argumentList,
[unnamedParameterCount, positionalArgumentCount]);
« no previous file with comments | « pkg/analyzer/lib/src/error/codes.dart ('k') | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698