| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "vm/parser.h" | 5 #include "vm/parser.h" |
| 6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
| 7 | 7 |
| 8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 13036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13047 Type& factory_type = Type::Handle(Z, Type::New( | 13047 Type& factory_type = Type::Handle(Z, Type::New( |
| 13048 factory_class, factory_type_args, type_pos, Heap::kNew)); | 13048 factory_class, factory_type_args, type_pos, Heap::kNew)); |
| 13049 factory_type ^= ClassFinalizer::FinalizeType( | 13049 factory_type ^= ClassFinalizer::FinalizeType( |
| 13050 current_class(), factory_type, ClassFinalizer::kFinalize); | 13050 current_class(), factory_type, ClassFinalizer::kFinalize); |
| 13051 factory_type_args = factory_type.arguments(); | 13051 factory_type_args = factory_type.arguments(); |
| 13052 ASSERT(factory_type_args.Length() == factory_class.NumTypeArguments()); | 13052 ASSERT(factory_type_args.Length() == factory_class.NumTypeArguments()); |
| 13053 } | 13053 } |
| 13054 factory_type_args = factory_type_args.Canonicalize(); | 13054 factory_type_args = factory_type_args.Canonicalize(); |
| 13055 ArgumentListNode* factory_param = new(Z) ArgumentListNode(literal_pos); | 13055 ArgumentListNode* factory_param = new(Z) ArgumentListNode(literal_pos); |
| 13056 // The kv_pair array is temporary and of element type dynamic. It is passed | 13056 // The kv_pair array is temporary and of element type dynamic. It is passed |
| 13057 // to the factory to initialize a properly typed map. | 13057 // to the factory to initialize a properly typed map. Pass a pre-allocated |
| 13058 ArrayNode* kv_pairs = new(Z) ArrayNode( | 13058 // array for the common empty map literal case. |
| 13059 TokenPos(), | 13059 if (kv_pairs_list.length() == 0) { |
| 13060 Type::ZoneHandle(Z, Type::ArrayType()), | 13060 LiteralNode* empty_array_literal = |
| 13061 kv_pairs_list); | 13061 new(Z) LiteralNode(TokenPos(), Object::empty_array()); |
| 13062 factory_param->Add(kv_pairs); | 13062 factory_param->Add(empty_array_literal); |
| 13063 } else { |
| 13064 ArrayNode* kv_pairs = new(Z) ArrayNode( |
| 13065 TokenPos(), |
| 13066 Type::ZoneHandle(Z, Type::ArrayType()), |
| 13067 kv_pairs_list); |
| 13068 factory_param->Add(kv_pairs); |
| 13069 } |
| 13070 |
| 13063 return CreateConstructorCallNode(literal_pos, | 13071 return CreateConstructorCallNode(literal_pos, |
| 13064 factory_type_args, | 13072 factory_type_args, |
| 13065 factory_method, | 13073 factory_method, |
| 13066 factory_param); | 13074 factory_param); |
| 13067 } | 13075 } |
| 13068 UNREACHABLE(); | 13076 UNREACHABLE(); |
| 13069 return NULL; | 13077 return NULL; |
| 13070 } | 13078 } |
| 13071 | 13079 |
| 13072 | 13080 |
| (...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14445 const ArgumentListNode& function_args, | 14453 const ArgumentListNode& function_args, |
| 14446 const LocalVariable* temp_for_last_arg, | 14454 const LocalVariable* temp_for_last_arg, |
| 14447 bool is_super_invocation) { | 14455 bool is_super_invocation) { |
| 14448 UNREACHABLE(); | 14456 UNREACHABLE(); |
| 14449 return NULL; | 14457 return NULL; |
| 14450 } | 14458 } |
| 14451 | 14459 |
| 14452 } // namespace dart | 14460 } // namespace dart |
| 14453 | 14461 |
| 14454 #endif // DART_PRECOMPILED_RUNTIME | 14462 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |