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

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

Issue 2978903002: Remove number from operator mismatch message. (Closed)
Patch Set: 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 fasta.outline_builder; 5 library fasta.outline_builder;
6 6
7 import 'package:kernel/ast.dart' show ProcedureKind; 7 import 'package:kernel/ast.dart' show ProcedureKind;
8 8
9 import '../../scanner/token.dart' show Token; 9 import '../../scanner/token.dart' show Token;
10 10
11 import '../builder/builder.dart'; 11 import '../builder/builder.dart';
12 12
13 import '../combinator.dart' show Combinator; 13 import '../combinator.dart' show Combinator;
14 14
15 import '../fasta_codes.dart' 15 import '../fasta_codes.dart'
16 show 16 show
17 Message, 17 Message,
18 codeExpectedBlockToSkip, 18 codeExpectedBlockToSkip,
19 messageOperatorWithOptionalFormals, 19 messageOperatorWithOptionalFormals,
20 messageTypedefNotFunction, 20 messageTypedefNotFunction,
21 templateDuplicatedParameterName, 21 templateDuplicatedParameterName,
22 templateDuplicatedParameterNameCause, 22 templateDuplicatedParameterNameCause,
23 templateOperatorParameterMismatch; 23 templateOperatorParameterMismatch0,
24 templateOperatorParameterMismatch1,
25 templateOperatorParameterMismatch2;
24 26
25 import '../modifier.dart' show abstractMask, externalMask, Modifier; 27 import '../modifier.dart' show abstractMask, externalMask, Modifier;
26 28
27 import '../operator.dart' 29 import '../operator.dart'
28 show 30 show
29 Operator, 31 Operator,
30 operatorFromString, 32 operatorFromString,
31 operatorToString, 33 operatorToString,
32 operatorRequiredArgumentCount; 34 operatorRequiredArgumentCount;
33 35
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 if (Operator.subtract == nameOrOperator && formals == null) { 377 if (Operator.subtract == nameOrOperator && formals == null) {
376 nameOrOperator = Operator.unaryMinus; 378 nameOrOperator = Operator.unaryMinus;
377 } 379 }
378 String name; 380 String name;
379 ProcedureKind kind; 381 ProcedureKind kind;
380 if (nameOrOperator is Operator) { 382 if (nameOrOperator is Operator) {
381 name = operatorToString(nameOrOperator); 383 name = operatorToString(nameOrOperator);
382 kind = ProcedureKind.Operator; 384 kind = ProcedureKind.Operator;
383 int requiredArgumentCount = operatorRequiredArgumentCount(nameOrOperator); 385 int requiredArgumentCount = operatorRequiredArgumentCount(nameOrOperator);
384 if ((formals?.length ?? 0) != requiredArgumentCount) { 386 if ((formals?.length ?? 0) != requiredArgumentCount) {
385 addCompileTimeError( 387 var template;
386 templateOperatorParameterMismatch.withArguments( 388 switch (requiredArgumentCount) {
387 name, requiredArgumentCount), 389 case 0:
388 charOffset); 390 template = templateOperatorParameterMismatch0;
391 break;
392
393 case 1:
394 template = templateOperatorParameterMismatch1;
395 break;
396
397 case 2:
398 template = templateOperatorParameterMismatch2;
Johnni Winther 2017/07/13 11:23:39 How do you handle `operator -(a, b)` ? It shouldn'
ahe 2017/07/13 11:32:19 Good point.
399 break;
400
401 default:
402 unhandled("$requiredArgumentCount", "operatorRequiredArgumentCount",
403 charOffset, uri);
404 }
405 addCompileTimeError(template.withArguments(name), charOffset);
389 } else { 406 } else {
390 if (formals != null) { 407 if (formals != null) {
391 for (FormalParameterBuilder formal in formals) { 408 for (FormalParameterBuilder formal in formals) {
392 if (!formal.isRequired) { 409 if (!formal.isRequired) {
393 addCompileTimeError( 410 addCompileTimeError(
394 messageOperatorWithOptionalFormals, formal.charOffset); 411 messageOperatorWithOptionalFormals, formal.charOffset);
395 } 412 }
396 } 413 }
397 } 414 }
398 } 415 }
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 Link<Token> handleMemberName(Link<Token> identifiers) { 903 Link<Token> handleMemberName(Link<Token> identifiers) {
887 if (!enableNative || identifiers.isEmpty) return identifiers; 904 if (!enableNative || identifiers.isEmpty) return identifiers;
888 return removeNativeClause(identifiers, stringExpectedAfterNative); 905 return removeNativeClause(identifiers, stringExpectedAfterNative);
889 } 906 }
890 907
891 @override 908 @override
892 void debugEvent(String name) { 909 void debugEvent(String name) {
893 // printEvent(name); 910 // printEvent(name);
894 } 911 }
895 } 912 }
OLDNEW
« 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