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

Unified Diff: pkg/dart_messages/lib/shared_messages.dart

Issue 1768143003: Use specific messages for const constructor with body. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 9 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/dart_messages/lib/generated/shared_messages.json ('k') | tests/compiler/dart2js/patch_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dart_messages/lib/shared_messages.dart
diff --git a/pkg/dart_messages/lib/shared_messages.dart b/pkg/dart_messages/lib/shared_messages.dart
index 5aa2cededb7a5963715c22b46f97fa240d8fe3e8..89a69bc217cc499042780f156105e35c1f8a45a1 100644
--- a/pkg/dart_messages/lib/shared_messages.dart
+++ b/pkg/dart_messages/lib/shared_messages.dart
@@ -191,37 +191,15 @@ final Map<String, Message> MESSAGES = {
}
]),
- // Const constructors (factory or not) may not have a body.
- 'CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY': new Message(
- id: 'LGJGHW',
- subId: 0,
- categories: [Category.parserError],
- template: "Const constructor or factory can't have a body.",
- howToFix: "Remove the 'const' keyword or the body.",
- usedBy: [dart2js],
- examples: const [
- r"""
- class C {
- const C() {}
- }
-
- main() => new C();""",
- r"""
- class C {
- const factory C() {}
- }
-
- main() => new C();"""
- ]),
// Const constructors may not have a body.
'CONST_CONSTRUCTOR_WITH_BODY': new Message(
id: 'LGJGHW',
- subId: 1,
+ subId: 0,
specializationOf: "CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY",
categories: [Category.parserError],
template: "Const constructor can't have a body.",
howToFix: "Try removing the 'const' keyword or the body.",
- usedBy: [analyzer],
+ usedBy: [analyzer, dart2js],
examples: const [
r"""
class C {
@@ -233,14 +211,14 @@ final Map<String, Message> MESSAGES = {
// Const constructor factories may only redirect (and must not have a body).
'CONST_FACTORY': new Message(
id: 'LGJGHW',
- subId: 2,
+ subId: 1,
specializationOf: "CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY",
categories: [Category.parserError],
template: "Only redirecting factory constructors can be declared to "
"be 'const'.",
howToFix: "Try removing the 'const' keyword or replacing the body with "
"'=' followed by a valid target.",
- usedBy: [analyzer],
+ usedBy: [analyzer, dart2js],
examples: const [
r"""
class C {
« no previous file with comments | « pkg/dart_messages/lib/generated/shared_messages.json ('k') | tests/compiler/dart2js/patch_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698