Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/warnings.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/warnings.dart b/sdk/lib/_internal/compiler/implementation/warnings.dart |
| index 59055aead79bb4fed3df30f75f7db6944ff659df..6f1f93841f7de292bf694bc4901cee5c6dae614e 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/warnings.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/warnings.dart |
| @@ -272,6 +272,29 @@ class MessageKind { |
| static const MessageKind CONST_CALLS_NON_CONST = const MessageKind( |
| 'Error: "const" constructor cannot call a non-const constructor.'); |
| + static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS = |
| + const MessageKind( |
| + "Error: Can't declare constructor 'const' on class #{className} " |
| + "because the class contains non-final instance fields.", |
| + howToFix: "Try making all fields final.", |
| + examples: const [""" |
| +class C { |
| + // 'a' must be declared final to allow for the const constructor. |
| + var a; |
| + const C(this.a); |
| +} |
| + |
| +main() => new C(0);"""]); |
| + |
| + static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD = |
| + const MessageKind('Info: This non-final field is blocking const ' |
|
karlklose
2013/09/05 12:43:42
'prevents using const constructors'?
Johnni Winther
2013/09/06 06:22:41
Done.
|
| + 'constructors.'); |
| + |
| + static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR = |
|
karlklose
2013/09/05 12:43:42
And something similar here.
Johnni Winther
2013/09/06 06:22:41
Done.
|
| + const MessageKind('Info: This const constructor is blocked by ' |
| + 'non-final fields.'); |
| + |
| + |
| static const MessageKind INITIALIZING_FORMAL_NOT_ALLOWED = const MessageKind( |
| 'Error: Initializing formal parameter only allowed in generative ' |
| 'constructor.'); |