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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/warnings.dart

Issue 23533040: Check for non-final field in the face of const constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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 part of dart2js; 5 part of dart2js;
6 6
7 const DONT_KNOW_HOW_TO_FIX = ""; 7 const DONT_KNOW_HOW_TO_FIX = "";
8 8
9 /** 9 /**
10 * The messages in this file should meet the following guide lines: 10 * The messages in this file should meet the following guide lines:
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 'Error: "super" call arguments and constructor parameters do not match.'); 265 'Error: "super" call arguments and constructor parameters do not match.');
266 266
267 static const MessageKind NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT = 267 static const MessageKind NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT =
268 const MessageKind( 268 const MessageKind(
269 'Error: Implicit "super" call arguments and constructor parameters ' 269 'Error: Implicit "super" call arguments and constructor parameters '
270 'do not match.'); 270 'do not match.');
271 271
272 static const MessageKind CONST_CALLS_NON_CONST = const MessageKind( 272 static const MessageKind CONST_CALLS_NON_CONST = const MessageKind(
273 'Error: "const" constructor cannot call a non-const constructor.'); 273 'Error: "const" constructor cannot call a non-const constructor.');
274 274
275 static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS =
276 const MessageKind(
277 "Error: Can't declare constructor 'const' on class #{className} "
278 "because the class contains non-final instance fields.",
279 howToFix: "Try making all fields final.",
280 examples: const ["""
281 class C {
282 // 'a' must be declared final to allow for the const constructor.
283 var a;
284 const C(this.a);
285 }
286
287 main() => new C(0);"""]);
288
289 static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD =
290 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.
291 'constructors.');
292
293 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.
294 const MessageKind('Info: This const constructor is blocked by '
295 'non-final fields.');
296
297
275 static const MessageKind INITIALIZING_FORMAL_NOT_ALLOWED = const MessageKind( 298 static const MessageKind INITIALIZING_FORMAL_NOT_ALLOWED = const MessageKind(
276 'Error: Initializing formal parameter only allowed in generative ' 299 'Error: Initializing formal parameter only allowed in generative '
277 'constructor.'); 300 'constructor.');
278 301
279 static const MessageKind INVALID_PARAMETER = const MessageKind( 302 static const MessageKind INVALID_PARAMETER = const MessageKind(
280 'Error: Cannot resolve parameter.'); 303 'Error: Cannot resolve parameter.');
281 304
282 static const MessageKind NOT_INSTANCE_FIELD = const MessageKind( 305 static const MessageKind NOT_INSTANCE_FIELD = const MessageKind(
283 'Error: "#{fieldName}" is not an instance field.'); 306 'Error: "#{fieldName}" is not an instance field.');
284 307
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 1060
1038 class CompileTimeConstantError extends Diagnostic { 1061 class CompileTimeConstantError extends Diagnostic {
1039 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse) 1062 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse)
1040 : super(kind, arguments, terse); 1063 : super(kind, arguments, terse);
1041 } 1064 }
1042 1065
1043 class CompilationError extends Diagnostic { 1066 class CompilationError extends Diagnostic {
1044 CompilationError(MessageKind kind, Map arguments, bool terse) 1067 CompilationError(MessageKind kind, Map arguments, bool terse)
1045 : super(kind, arguments, terse); 1068 : super(kind, arguments, terse);
1046 } 1069 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698