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

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

Issue 10916002: Change switch to give errors when cases don't follow the newest syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: use .compileType on elements. Created 8 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 class MessageKind { 5 class MessageKind {
6 final String template; 6 final String template;
7 const MessageKind(this.template); 7 const MessageKind(this.template);
8 8
9 static const GENERIC = const MessageKind('#{1}'); 9 static const GENERIC = const MessageKind('#{1}');
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 static const TYPE_VARIABLE_AS_CONSTRUCTOR = const MessageKind( 123 static const TYPE_VARIABLE_AS_CONSTRUCTOR = const MessageKind(
124 'cannot use type variable as constructor'); 124 'cannot use type variable as constructor');
125 static const DUPLICATE_TYPE_VARIABLE_NAME = const MessageKind( 125 static const DUPLICATE_TYPE_VARIABLE_NAME = const MessageKind(
126 'type variable #{1} already declared'); 126 'type variable #{1} already declared');
127 static const INVALID_BREAK = const MessageKind( 127 static const INVALID_BREAK = const MessageKind(
128 'target of break is not a statement'); 128 'target of break is not a statement');
129 static const INVALID_USE_OF_SUPER = const MessageKind( 129 static const INVALID_USE_OF_SUPER = const MessageKind(
130 'super not allowed here'); 130 'super not allowed here');
131 static const INVALID_CASE_DEFAULT = const MessageKind( 131 static const INVALID_CASE_DEFAULT = const MessageKind(
132 'default only allowed on last case of a switch'); 132 'default only allowed on last case of a switch');
133 static const INVALID_CASE_EXPRESSION = const MessageKind( 133
134 'case expression is not a compile-time constant int or string.'); 134 static const SWITCH_CASE_TYPES_NOT_EQUAL = const MessageKind(
135 static const INVALID_CASE_EXPRESSION_TYPE = const MessageKind( 135 "case expressions don't all have the same type.");
136 "case expressions don't all have the same type " 136 static const SWITCH_CASE_VALUE_OVERRIDES_EQUALS = const MessageKind(
137 "(must be all int or String)."); 137 "case expression value overrides 'operator=='.");
138 static const SWITCH_INVALID = const MessageKind(
139 "switch cases contain invalid expressions.");
140
138 static const INVALID_ARGUMENT_AFTER_NAMED = const MessageKind( 141 static const INVALID_ARGUMENT_AFTER_NAMED = const MessageKind(
139 'non-named argument after named argument'); 142 'non-named argument after named argument');
140 143
141 static const NOT_A_COMPILE_TIME_CONSTANT = const MessageKind( 144 static const NOT_A_COMPILE_TIME_CONSTANT = const MessageKind(
142 'not a compile-time constant'); 145 'not a compile-time constant');
143 static const CYCLIC_COMPILE_TIME_CONSTANTS = const MessageKind( 146 static const CYCLIC_COMPILE_TIME_CONSTANTS = const MessageKind(
144 'cycle in the compile-time constant computation'); 147 'cycle in the compile-time constant computation');
145 148
146 static const KEY_NOT_A_STRING_LITERAL = const MessageKind( 149 static const KEY_NOT_A_STRING_LITERAL = const MessageKind(
147 'map-literal key not a string literal'); 150 'map-literal key not a string literal');
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 322
320 class CompileTimeConstantError extends Diagnostic { 323 class CompileTimeConstantError extends Diagnostic {
321 CompileTimeConstantError(MessageKind kind, List arguments) 324 CompileTimeConstantError(MessageKind kind, List arguments)
322 : super(kind, arguments); 325 : super(kind, arguments);
323 } 326 }
324 327
325 class CompilationError extends Diagnostic { 328 class CompilationError extends Diagnostic {
326 CompilationError(MessageKind kind, List arguments) 329 CompilationError(MessageKind kind, List arguments)
327 : super(kind, arguments); 330 : super(kind, arguments);
328 } 331 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698