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 " |