| 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 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 8758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8769 String::Handle(element_type.UserVisibleName()).ToCString()); | 8769 String::Handle(element_type.UserVisibleName()).ToCString()); |
| 8770 } | 8770 } |
| 8771 } | 8771 } |
| 8772 const_list.SetAt(i, elem->AsLiteralNode()->literal()); | 8772 const_list.SetAt(i, elem->AsLiteralNode()->literal()); |
| 8773 } | 8773 } |
| 8774 const_list ^= const_list.Canonicalize(); | 8774 const_list ^= const_list.Canonicalize(); |
| 8775 const_list.MakeImmutable(); | 8775 const_list.MakeImmutable(); |
| 8776 return new LiteralNode(literal_pos, const_list); | 8776 return new LiteralNode(literal_pos, const_list); |
| 8777 } else { | 8777 } else { |
| 8778 // Factory call at runtime. | 8778 // Factory call at runtime. |
| 8779 String& list_literal_factory_class_name = String::Handle( | 8779 String& list_class_name = String::Handle(Symbols::ListImplementation()); |
| 8780 Symbols::ListLiteralFactoryClass()); | 8780 const Class& list_class = Class::Handle(LookupCoreClass(list_class_name)); |
| 8781 const Class& list_literal_factory_class = | 8781 ASSERT(!list_class.IsNull()); |
| 8782 Class::Handle(LookupCoreClass(list_literal_factory_class_name)); | |
| 8783 ASSERT(!list_literal_factory_class.IsNull()); | |
| 8784 const String& list_literal_factory_name = | 8782 const String& list_literal_factory_name = |
| 8785 String::Handle(Symbols::ListLiteralFactory()); | 8783 String::Handle(Symbols::ListLiteralFactory()); |
| 8786 const Function& list_literal_factory = Function::ZoneHandle( | 8784 const Function& list_literal_factory = Function::ZoneHandle( |
| 8787 list_literal_factory_class.LookupFactory(list_literal_factory_name)); | 8785 list_class.LookupFactory(list_literal_factory_name)); |
| 8788 ASSERT(!list_literal_factory.IsNull()); | 8786 ASSERT(!list_literal_factory.IsNull()); |
| 8789 if (!type_arguments.IsNull() && | 8787 if (!type_arguments.IsNull() && |
| 8790 !type_arguments.IsInstantiated() && | 8788 !type_arguments.IsInstantiated() && |
| 8791 (current_block_->scope->function_level() > 0)) { | 8789 (current_block_->scope->function_level() > 0)) { |
| 8792 // Make sure that the instantiator is captured. | 8790 // Make sure that the instantiator is captured. |
| 8793 CaptureInstantiator(); | 8791 CaptureInstantiator(); |
| 8794 } | 8792 } |
| 8795 ArgumentListNode* factory_param = new ArgumentListNode(literal_pos); | 8793 ArgumentListNode* factory_param = new ArgumentListNode(literal_pos); |
| 8796 factory_param->Add(list); | 8794 factory_param->Add(list); |
| 8797 AbstractTypeArguments& canonical_type_arguments = | 8795 AbstractTypeArguments& canonical_type_arguments = |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8994 constr_args)); | 8992 constr_args)); |
| 8995 if (constructor_result.IsUnhandledException()) { | 8993 if (constructor_result.IsUnhandledException()) { |
| 8996 return GenerateRethrow(literal_pos, constructor_result); | 8994 return GenerateRethrow(literal_pos, constructor_result); |
| 8997 } else { | 8995 } else { |
| 8998 const Instance& const_instance = Instance::Cast(constructor_result); | 8996 const Instance& const_instance = Instance::Cast(constructor_result); |
| 8999 return new LiteralNode(literal_pos, | 8997 return new LiteralNode(literal_pos, |
| 9000 Instance::ZoneHandle(const_instance.raw())); | 8998 Instance::ZoneHandle(const_instance.raw())); |
| 9001 } | 8999 } |
| 9002 } else { | 9000 } else { |
| 9003 // Factory call at runtime. | 9001 // Factory call at runtime. |
| 9004 String& map_literal_factory_class_name = String::Handle( | 9002 String& map_class_name = String::Handle(Symbols::MapImplementation()); |
| 9005 Symbols::MapLiteralFactoryClass()); | 9003 const Class& map_class = Class::Handle(LookupCoreClass(map_class_name)); |
| 9006 const Class& map_literal_factory_class = | 9004 ASSERT(!map_class.IsNull()); |
| 9007 Class::Handle(LookupCoreClass(map_literal_factory_class_name)); | |
| 9008 ASSERT(!map_literal_factory_class.IsNull()); | |
| 9009 const String& map_literal_factory_name = | 9005 const String& map_literal_factory_name = |
| 9010 String::Handle(Symbols::MapLiteralFactory()); | 9006 String::Handle(Symbols::MapLiteralFactory()); |
| 9011 const Function& map_literal_factory = Function::ZoneHandle( | 9007 const Function& map_literal_factory = Function::ZoneHandle( |
| 9012 map_literal_factory_class.LookupFactory(map_literal_factory_name)); | 9008 map_class.LookupFactory(map_literal_factory_name)); |
| 9013 ASSERT(!map_literal_factory.IsNull()); | 9009 ASSERT(!map_literal_factory.IsNull()); |
| 9014 if (!map_type_arguments.IsNull() && | 9010 if (!map_type_arguments.IsNull() && |
| 9015 !map_type_arguments.IsInstantiated() && | 9011 !map_type_arguments.IsInstantiated() && |
| 9016 (current_block_->scope->function_level() > 0)) { | 9012 (current_block_->scope->function_level() > 0)) { |
| 9017 // Make sure that the instantiator is captured. | 9013 // Make sure that the instantiator is captured. |
| 9018 CaptureInstantiator(); | 9014 CaptureInstantiator(); |
| 9019 } | 9015 } |
| 9020 ArgumentListNode* factory_param = new ArgumentListNode(literal_pos); | 9016 ArgumentListNode* factory_param = new ArgumentListNode(literal_pos); |
| 9021 factory_param->Add(kv_pairs); | 9017 factory_param->Add(kv_pairs); |
| 9022 return CreateConstructorCallNode(literal_pos, | 9018 return CreateConstructorCallNode(literal_pos, |
| (...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10013 void Parser::SkipQualIdent() { | 10009 void Parser::SkipQualIdent() { |
| 10014 ASSERT(IsIdentifier()); | 10010 ASSERT(IsIdentifier()); |
| 10015 ConsumeToken(); | 10011 ConsumeToken(); |
| 10016 if (CurrentToken() == Token::kPERIOD) { | 10012 if (CurrentToken() == Token::kPERIOD) { |
| 10017 ConsumeToken(); // Consume the kPERIOD token. | 10013 ConsumeToken(); // Consume the kPERIOD token. |
| 10018 ExpectIdentifier("identifier expected after '.'"); | 10014 ExpectIdentifier("identifier expected after '.'"); |
| 10019 } | 10015 } |
| 10020 } | 10016 } |
| 10021 | 10017 |
| 10022 } // namespace dart | 10018 } // namespace dart |
| OLD | NEW |