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

Unified Diff: runtime/vm/parser.cc

Issue 12021022: Stop supporting map literals with 1 type argument (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/oauth2/lib/src/utils.dart ('k') | sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 17246)
+++ runtime/vm/parser.cc (working copy)
@@ -27,8 +27,6 @@
DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors.");
DEFINE_FLAG(bool, silent_warnings, false, "Silence warnings.");
-DEFINE_FLAG(bool, warn_legacy_map_literal, false,
- "Warning on legacy map literal syntax (single type argument)");
static void CheckedModeHandler(bool value) {
FLAG_enable_asserts = value;
@@ -8638,30 +8636,17 @@
if (!map_type_arguments.IsNull()) {
ASSERT(map_type_arguments.Length() > 0);
// Map literals take two type arguments.
- if (map_type_arguments.Length() < 2) {
- // TODO(hausner): Remove legacy syntax support.
- // We temporarily accept a single type argument.
- if (FLAG_warn_legacy_map_literal) {
- Warning(type_pos,
- "a map literal takes two type arguments specifying "
- "the key type and the value type");
- }
- TypeArguments& type_array = TypeArguments::Handle(TypeArguments::New(2));
- type_array.SetTypeAt(0, Type::Handle(Type::StringType()));
- type_array.SetTypeAt(1, value_type);
- map_type_arguments = type_array.raw();
- } else if (map_type_arguments.Length() > 2) {
+ if (map_type_arguments.Length() != 2) {
ErrorMsg(type_pos,
"a map literal takes two type arguments specifying "
"the key type and the value type");
- } else {
- const AbstractType& key_type =
- AbstractType::Handle(map_type_arguments.TypeAt(0));
- value_type = map_type_arguments.TypeAt(1);
- if (!key_type.IsStringType()) {
- ErrorMsg(type_pos, "the key type of a map literal must be 'String'");
- }
}
+ const AbstractType& key_type =
+ AbstractType::Handle(map_type_arguments.TypeAt(0));
+ value_type = map_type_arguments.TypeAt(1);
+ if (!key_type.IsStringType()) {
+ ErrorMsg(type_pos, "the key type of a map literal must be 'String'");
+ }
if (is_const && !value_type.IsInstantiated()) {
ErrorMsg(type_pos,
"the type argument of a constant map literal cannot include "
« no previous file with comments | « pkg/oauth2/lib/src/utils.dart ('k') | sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698