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

Unified Diff: pkg/front_end/lib/src/fasta/source/outline_builder.dart

Issue 2978903002: Remove number from operator mismatch message. (Closed)
Patch Set: Add missing show clause. 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/front_end/lib/src/fasta/fasta_codes_generated.dart ('k') | pkg/front_end/messages.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/source/outline_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index e5e8f2552afd1dcaf943c23557711ff399fc4a7d..04486e5594ece7e6786f75cff6fb6434dd6924fb 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -20,7 +20,10 @@ import '../fasta_codes.dart'
messageTypedefNotFunction,
templateDuplicatedParameterName,
templateDuplicatedParameterNameCause,
- templateOperatorParameterMismatch;
+ templateOperatorMinusParameterMismatch,
+ templateOperatorParameterMismatch0,
+ templateOperatorParameterMismatch1,
+ templateOperatorParameterMismatch2;
import '../modifier.dart' show abstractMask, externalMask, Modifier;
@@ -388,10 +391,29 @@ class OutlineBuilder extends UnhandledListener {
kind = ProcedureKind.Operator;
int requiredArgumentCount = operatorRequiredArgumentCount(nameOrOperator);
if ((formals?.length ?? 0) != requiredArgumentCount) {
- addCompileTimeError(
- templateOperatorParameterMismatch.withArguments(
- name, requiredArgumentCount),
- charOffset);
+ var template;
+ switch (requiredArgumentCount) {
+ case 0:
+ template = templateOperatorParameterMismatch0;
+ break;
+
+ case 1:
+ if (Operator.subtract == nameOrOperator) {
+ template = templateOperatorMinusParameterMismatch;
+ } else {
+ template = templateOperatorParameterMismatch1;
+ }
+ break;
+
+ case 2:
+ template = templateOperatorParameterMismatch2;
+ break;
+
+ default:
+ unhandled("$requiredArgumentCount", "operatorRequiredArgumentCount",
+ charOffset, uri);
+ }
+ addCompileTimeError(template.withArguments(name), charOffset);
} else {
if (formals != null) {
for (FormalParameterBuilder formal in formals) {
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta_codes_generated.dart ('k') | pkg/front_end/messages.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698