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

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: Updated cf. comments. 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 'Error: "super" call arguments and constructor parameters do not match.'); 275 'Error: "super" call arguments and constructor parameters do not match.');
276 276
277 static const MessageKind NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT = 277 static const MessageKind NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT =
278 const MessageKind( 278 const MessageKind(
279 'Error: Implicit "super" call arguments and constructor parameters ' 279 'Error: Implicit "super" call arguments and constructor parameters '
280 'do not match.'); 280 'do not match.');
281 281
282 static const MessageKind CONST_CALLS_NON_CONST = const MessageKind( 282 static const MessageKind CONST_CALLS_NON_CONST = const MessageKind(
283 'Error: "const" constructor cannot call a non-const constructor.'); 283 'Error: "const" constructor cannot call a non-const constructor.');
284 284
285 static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS =
286 const MessageKind(
287 "Error: Can't declare constructor 'const' on class #{className} "
288 "because the class contains non-final instance fields.",
289 howToFix: "Try making all fields final.",
290 examples: const ["""
291 class C {
292 // 'a' must be declared final to allow for the const constructor.
293 var a;
294 const C(this.a);
295 }
296
297 main() => new C(0);"""]);
298
299 static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD =
300 const MessageKind('Info: This non-final field prevents using const '
301 'constructors.');
302
303 static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR =
304 const MessageKind('Info: This const constructor is not allowed due to '
305 'non-final fields.');
306
307
285 static const MessageKind INITIALIZING_FORMAL_NOT_ALLOWED = const MessageKind( 308 static const MessageKind INITIALIZING_FORMAL_NOT_ALLOWED = const MessageKind(
286 'Error: Initializing formal parameter only allowed in generative ' 309 'Error: Initializing formal parameter only allowed in generative '
287 'constructor.'); 310 'constructor.');
288 311
289 static const MessageKind INVALID_PARAMETER = const MessageKind( 312 static const MessageKind INVALID_PARAMETER = const MessageKind(
290 'Error: Cannot resolve parameter.'); 313 'Error: Cannot resolve parameter.');
291 314
292 static const MessageKind NOT_INSTANCE_FIELD = const MessageKind( 315 static const MessageKind NOT_INSTANCE_FIELD = const MessageKind(
293 'Error: "#{fieldName}" is not an instance field.'); 316 'Error: "#{fieldName}" is not an instance field.');
294 317
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 1070
1048 class CompileTimeConstantError extends Diagnostic { 1071 class CompileTimeConstantError extends Diagnostic {
1049 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse) 1072 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse)
1050 : super(kind, arguments, terse); 1073 : super(kind, arguments, terse);
1051 } 1074 }
1052 1075
1053 class CompilationError extends Diagnostic { 1076 class CompilationError extends Diagnostic {
1054 CompilationError(MessageKind kind, Map arguments, bool terse) 1077 CompilationError(MessageKind kind, Map arguments, bool terse)
1055 : super(kind, arguments, terse); 1078 : super(kind, arguments, terse);
1056 } 1079 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | sdk/lib/_internal/lib/foreign_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698