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

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

Issue 1897293003: Required params message fix. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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/error_verifier.dart
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index fd47d73e36739806367265ac44111d89df3c92ab..8fa08b58b9f410bd0f509cbad4423d6bf715b236 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -4252,10 +4252,16 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
String paramName = param.name;
if (!_containsNamedExpression(argumentList, paramName)) {
DartObject constantValue = annotation.constantValue;
- String reason =
- constantValue.getField('reason')?.toStringValue() ?? '';
- _errorReporter.reportErrorForNode(
- HintCode.MISSING_REQUIRED_PARAM, node, [paramName, reason]);
+ String reason = constantValue.getField('reason')?.toStringValue();
+ if (reason != null) {
+ _errorReporter.reportErrorForNode(
+ HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS,
+ node,
+ [paramName, reason]);
+ } else {
+ _errorReporter.reportErrorForNode(
+ HintCode.MISSING_REQUIRED_PARAM, node, [paramName]);
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698