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

Side by Side Diff: pkg/compiler/lib/src/diagnostics/messages.dart

Issue 2411633002: Add `=` as default-value separator for named parameters. (Closed)
Patch Set: Add co19 issue number Created 4 years, 2 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/analyzer/test/generated/parser_test.dart ('k') | pkg/compiler/lib/src/parser/parser.dart » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** 5 /**
6 * The messages in this file should meet the following guide lines: 6 * The messages in this file should meet the following guide lines:
7 * 7 *
8 * 1. The message should be a complete sentence starting with an uppercase 8 * 1. The message should be a complete sentence starting with an uppercase
9 * letter, and ending with a period. 9 * letter, and ending with a period.
10 * 10 *
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 MISSING_FORMALS, 319 MISSING_FORMALS,
320 MISSING_LIBRARY_NAME, 320 MISSING_LIBRARY_NAME,
321 MISSING_MAIN, 321 MISSING_MAIN,
322 MISSING_PART_OF_TAG, 322 MISSING_PART_OF_TAG,
323 MISSING_TOKEN_AFTER_THIS, 323 MISSING_TOKEN_AFTER_THIS,
324 MISSING_TOKEN_BEFORE_THIS, 324 MISSING_TOKEN_BEFORE_THIS,
325 MISSING_TYPE_ARGUMENT, 325 MISSING_TYPE_ARGUMENT,
326 MULTI_INHERITANCE, 326 MULTI_INHERITANCE,
327 NAMED_ARGUMENT_NOT_FOUND, 327 NAMED_ARGUMENT_NOT_FOUND,
328 NAMED_FUNCTION_EXPRESSION, 328 NAMED_FUNCTION_EXPRESSION,
329 NAMED_PARAMETER_WITH_EQUALS,
330 NATIVE_NOT_SUPPORTED, 329 NATIVE_NOT_SUPPORTED,
331 NO_BREAK_TARGET, 330 NO_BREAK_TARGET,
332 NO_CATCH_NOR_FINALLY, 331 NO_CATCH_NOR_FINALLY,
333 NO_COMMON_SUBTYPES, 332 NO_COMMON_SUBTYPES,
334 NO_CONTINUE_TARGET, 333 NO_CONTINUE_TARGET,
335 NO_INSTANCE_AVAILABLE, 334 NO_INSTANCE_AVAILABLE,
336 NO_MATCHING_CONSTRUCTOR, 335 NO_MATCHING_CONSTRUCTOR,
337 NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT, 336 NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT,
338 NO_STATIC_OVERRIDE, 337 NO_STATIC_OVERRIDE,
339 NO_STATIC_OVERRIDE_CONT, 338 NO_STATIC_OVERRIDE_CONT,
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 foo(a: 1) => print(a); 1364 foo(a: 1) => print(a);
1366 foo(2); 1365 foo(2);
1367 }""", 1366 }""",
1368 """ 1367 """
1369 main() { 1368 main() {
1370 foo(a = 1) => print(a); 1369 foo(a = 1) => print(a);
1371 foo(2); 1370 foo(2);
1372 }""" 1371 }"""
1373 ]), 1372 ]),
1374 1373
1375 MessageKind.NAMED_PARAMETER_WITH_EQUALS: const MessageTemplate(
1376 MessageKind.NAMED_PARAMETER_WITH_EQUALS,
1377 "Named optional parameters can't use '=' to specify a default "
1378 "value.",
1379 howToFix: "Try replacing '=' with ':'.",
1380 examples: const [
1381 """
1382 main() {
1383 foo({a = 1}) => print(a);
1384 foo(a: 2);
1385 }"""
1386 ]),
1387
1388 MessageKind.POSITIONAL_PARAMETER_WITH_EQUALS: const MessageTemplate( 1374 MessageKind.POSITIONAL_PARAMETER_WITH_EQUALS: const MessageTemplate(
1389 MessageKind.POSITIONAL_PARAMETER_WITH_EQUALS, 1375 MessageKind.POSITIONAL_PARAMETER_WITH_EQUALS,
1390 "Positional optional parameters can't use ':' to specify a " 1376 "Positional optional parameters can't use ':' to specify a "
1391 "default value.", 1377 "default value.",
1392 howToFix: "Try replacing ':' with '='.", 1378 howToFix: "Try replacing ':' with '='.",
1393 examples: const [ 1379 examples: const [
1394 """ 1380 """
1395 main() { 1381 main() {
1396 foo([a: 1]) => print(a); 1382 foo([a: 1]) => print(a);
1397 foo(2); 1383 foo(2);
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after
3817 static String convertToString(value) { 3803 static String convertToString(value) {
3818 if (value is ErrorToken) { 3804 if (value is ErrorToken) {
3819 // Shouldn't happen. 3805 // Shouldn't happen.
3820 return value.assertionMessage; 3806 return value.assertionMessage;
3821 } else if (value is Token) { 3807 } else if (value is Token) {
3822 value = value.value; 3808 value = value.value;
3823 } 3809 }
3824 return '$value'; 3810 return '$value';
3825 } 3811 }
3826 } 3812 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_test.dart ('k') | pkg/compiler/lib/src/parser/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698