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

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

Issue 1706033002: More shared messages. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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') | no next file » | 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 ea556ba2b8036e4e48138bd28875526c459d7581..006862b2f77a11a9a6f96ae53046f61d3f48c2db 100644
--- a/pkg/dart_messages/lib/shared_messages.dart
+++ b/pkg/dart_messages/lib/shared_messages.dart
@@ -75,6 +75,8 @@ class Category {
static final parserError = new Category("ParserError");
+ static final compileTimeError = new Category("CompileTimeError");
+
final String name;
Category(this.name);
@@ -401,4 +403,56 @@ final Map<String, Message> MESSAGES = {
howToFix: "Try removing the return type.",
usedBy: [analyzer, dart2js],
examples: const ["class A { int A() {} } main() { new A(); }",]),
+
+ /**
+ * 13.12 Return: It is a compile-time error if a return statement of the form
+ * <i>return e;</i> appears in a generative constructor.
+ */
+ 'RETURN_IN_GENERATIVE_CONSTRUCTOR': new Message(
+ id: 'UOTDQH',
+ category: Category.compileTimeError,
+ template: "Constructors can't return values.",
+ howToFix:
+ "Try removing the return statement or using a factory constructor.",
+ usedBy: [
+ analyzer,
+ dart2js
+ ],
+ examples: const [
+ """
+ class C {
+ C() {
+ return 1;
+ }
+ }
+
+ main() => new C();"""
+ ]),
+
+ /**
+ * 13.12 Return: It is a compile-time error if a return statement of the form
+ * <i>return e;</i> appears in a generator function.
+ */
+ 'RETURN_IN_GENERATOR': new Message(
+ id: 'JRUTUQ',
+ subId: 0,
+ category: Category.compileTimeError,
+ template: "Can't return a value from a generator function "
+ "(using the '#{modifier}' modifier).",
+ howToFix: "Try removing the value, replacing 'return' with 'yield' or"
+ " changing the method body modifier",
+ usedBy: [
+ analyzer,
+ dart2js
+ ],
+ examples: const [
+ """
+ foo() async* { return 0; }
+ main() => foo();
+ """,
+ """
+ foo() sync* { return 0; }
+ main() => foo();
+ """
+ ]),
};
« no previous file with comments | « pkg/dart_messages/lib/generated/shared_messages.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698