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

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

Issue 339583004: Add a compile time error for non-static const fields (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressing Comment Created 6 years, 5 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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 C() { 984 C() {
985 return 1; 985 return 1;
986 } 986 }
987 } 987 }
988 988
989 main() => new C();"""]); 989 main() => new C();"""]);
990 990
991 static const MessageKind ILLEGAL_FINAL_METHOD_MODIFIER = const MessageKind( 991 static const MessageKind ILLEGAL_FINAL_METHOD_MODIFIER = const MessageKind(
992 "Cannot have final modifier on method."); 992 "Cannot have final modifier on method.");
993 993
994 static const MessageKind ILLEGAL_CONST_FIELD_MODIFIER = const MessageKind(
995 "Cannot have const modifier on non-static field.",
996 howToFix: "Try adding a static modifier, or removing the const modifier.",
997 examples: const ["""
998 class C {
999 const int a = 1;
1000 }
1001
1002 main() => new C();"""]);
1003
994 static const MessageKind ILLEGAL_CONSTRUCTOR_MODIFIERS = const MessageKind( 1004 static const MessageKind ILLEGAL_CONSTRUCTOR_MODIFIERS = const MessageKind(
995 "Illegal constructor modifiers: '#{modifiers}'."); 1005 "Illegal constructor modifiers: '#{modifiers}'.");
996 1006
997 static const MessageKind ILLEGAL_MIXIN_APPLICATION_MODIFIERS = 1007 static const MessageKind ILLEGAL_MIXIN_APPLICATION_MODIFIERS =
998 const MessageKind( 1008 const MessageKind(
999 "Illegal mixin application modifiers: '#{modifiers}'."); 1009 "Illegal mixin application modifiers: '#{modifiers}'.");
1000 1010
1001 static const MessageKind ILLEGAL_MIXIN_SUPERCLASS = const MessageKind( 1011 static const MessageKind ILLEGAL_MIXIN_SUPERCLASS = const MessageKind(
1002 "Class used as mixin must have Object as superclass."); 1012 "Class used as mixin must have Object as superclass.");
1003 1013
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 static String convertToString(value) { 2091 static String convertToString(value) {
2082 if (value is ErrorToken) { 2092 if (value is ErrorToken) {
2083 // Shouldn't happen. 2093 // Shouldn't happen.
2084 return value.assertionMessage; 2094 return value.assertionMessage;
2085 } else if (value is Token) { 2095 } else if (value is Token) {
2086 value = value.value; 2096 value = value.value;
2087 } 2097 }
2088 return '$value'; 2098 return '$value';
2089 } 2099 }
2090 } 2100 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698