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

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

Issue 23948006: Emit a compile-time error on members with the name of their enclosing class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: dart2dart test expectations. 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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 811
812 static const MessageKind CONST_WITHOUT_INITIALIZER = const MessageKind( 812 static const MessageKind CONST_WITHOUT_INITIALIZER = const MessageKind(
813 "Error: A constant variable must be initialized.", 813 "Error: A constant variable must be initialized.",
814 howToFix: "Try adding an initializer or " 814 howToFix: "Try adding an initializer or "
815 "removing the 'const' modifier.", 815 "removing the 'const' modifier.",
816 examples: const [""" 816 examples: const ["""
817 void main() { 817 void main() {
818 const c; // This constant variable must be initialized. 818 const c; // This constant variable must be initialized.
819 }"""]); 819 }"""]);
820 820
821 static const MessageKind MEMBER_USES_CLASS_NAME = const MessageKind(
822 "Error: Member variable can't have the same name as the class it is "
823 "declared in.",
824 howToFix: "Try renaming the variable.",
825 examples: const ["""
826 class A { var A; }
827 main() {
828 var a = new A();
829 a.A = 1;
830 }
831 """, """
832 class A { static var A; }
833 main() => A.A = 1;
834 """]);
821 835
822 static const MessageKind WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT = 836 static const MessageKind WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT =
823 const MessageKind( 837 const MessageKind(
824 'Error: Wrong number of arguments to assert. Should be 1, but given ' 838 'Error: Wrong number of arguments to assert. Should be 1, but given '
825 '#{argumentCount}.'); 839 '#{argumentCount}.');
826 840
827 static const MessageKind ASSERT_IS_GIVEN_NAMED_ARGUMENTS = const MessageKind( 841 static const MessageKind ASSERT_IS_GIVEN_NAMED_ARGUMENTS = const MessageKind(
828 'Error: "assert" takes no named arguments, but given #{argumentCount}.'); 842 'Error: "assert" takes no named arguments, but given #{argumentCount}.');
829 843
830 static const MessageKind FACTORY_REDIRECTION_IN_NON_FACTORY = 844 static const MessageKind FACTORY_REDIRECTION_IN_NON_FACTORY =
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 1292
1279 class CompileTimeConstantError extends Diagnostic { 1293 class CompileTimeConstantError extends Diagnostic {
1280 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse) 1294 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse)
1281 : super(kind, arguments, terse); 1295 : super(kind, arguments, terse);
1282 } 1296 }
1283 1297
1284 class CompilationError extends Diagnostic { 1298 class CompilationError extends Diagnostic {
1285 CompilationError(MessageKind kind, Map arguments, bool terse) 1299 CompilationError(MessageKind kind, Map arguments, bool terse)
1286 : super(kind, arguments, terse); 1300 : super(kind, arguments, terse);
1287 } 1301 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/elements/modelx.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698