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

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: 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 can't have the same name as the class it is declared in.",
Johnni Winther 2013/09/20 06:57:36 Member -> Members
karlklose 2013/09/20 07:54:28 It is short for 'A member', and I think that is ho
823 howToFix: "Try renaming the variable.",
Johnni Winther 2013/09/20 06:57:36 Do you know it is a variable? Couldn't it be a met
karlklose 2013/09/20 07:54:28 If it was a method, we would warn about the modifi
824 examples: const ["""
825 class A { var A; }
826 main() {
827 var a = new A();
828 a.A = 1;
829 }
830 """, """
831 class A { static var A; }
832 main() => A.A = 1;
833 """]);
821 834
822 static const MessageKind WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT = 835 static const MessageKind WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT =
823 const MessageKind( 836 const MessageKind(
824 'Error: Wrong number of arguments to assert. Should be 1, but given ' 837 'Error: Wrong number of arguments to assert. Should be 1, but given '
825 '#{argumentCount}.'); 838 '#{argumentCount}.');
826 839
827 static const MessageKind ASSERT_IS_GIVEN_NAMED_ARGUMENTS = const MessageKind( 840 static const MessageKind ASSERT_IS_GIVEN_NAMED_ARGUMENTS = const MessageKind(
828 'Error: "assert" takes no named arguments, but given #{argumentCount}.'); 841 'Error: "assert" takes no named arguments, but given #{argumentCount}.');
829 842
830 static const MessageKind FACTORY_REDIRECTION_IN_NON_FACTORY = 843 static const MessageKind FACTORY_REDIRECTION_IN_NON_FACTORY =
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 1291
1279 class CompileTimeConstantError extends Diagnostic { 1292 class CompileTimeConstantError extends Diagnostic {
1280 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse) 1293 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse)
1281 : super(kind, arguments, terse); 1294 : super(kind, arguments, terse);
1282 } 1295 }
1283 1296
1284 class CompilationError extends Diagnostic { 1297 class CompilationError extends Diagnostic {
1285 CompilationError(MessageKind kind, Map arguments, bool terse) 1298 CompilationError(MessageKind kind, Map arguments, bool terse)
1286 : super(kind, arguments, terse); 1299 : super(kind, arguments, terse);
1287 } 1300 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/elements/modelx.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698