| 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 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 } | 1282 } |
| 1283 | 1283 |
| 1284 | 1284 |
| 1285 // Lookup class in the corelib implementation which contains various VM | 1285 // Lookup class in the corelib implementation which contains various VM |
| 1286 // helper methods and classes. | 1286 // helper methods and classes. |
| 1287 static RawClass* LookupImplClass(const String& class_name) { | 1287 static RawClass* LookupImplClass(const String& class_name) { |
| 1288 return Library::Handle(Library::CoreImplLibrary()).LookupClass(class_name); | 1288 return Library::Handle(Library::CoreImplLibrary()).LookupClass(class_name); |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 | 1291 |
| 1292 // Lookup class in the corelib which also contains various VM | 1292 // Lookup class in the coreimpl lib which also contains various VM |
| 1293 // helper methods and classes. Allow look up of private classes. | 1293 // helper methods and classes. Allow look up of private classes. |
| 1294 static RawClass* LookupCoreClass(const String& class_name) { | 1294 static RawClass* LookupCoreImplClass(const String& class_name) { |
| 1295 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 1295 const Library& coreimpl_lib = Library::Handle(Library::CoreImplLibrary()); |
| 1296 String& name = String::Handle(class_name.raw()); | 1296 String& name = String::Handle(class_name.raw()); |
| 1297 if (class_name.CharAt(0) == Scanner::kPrivateIdentifierStart) { | 1297 if (class_name.CharAt(0) == Scanner::kPrivateIdentifierStart) { |
| 1298 // Private identifiers are mangled on a per script basis. | 1298 // Private identifiers are mangled on a per script basis. |
| 1299 name = String::Concat(name, String::Handle(core_lib.private_key())); | 1299 name = String::Concat(name, String::Handle(coreimpl_lib.private_key())); |
| 1300 name = Symbols::New(name); | 1300 name = Symbols::New(name); |
| 1301 } | 1301 } |
| 1302 return core_lib.LookupClass(name); | 1302 return coreimpl_lib.LookupClass(name); |
| 1303 } | 1303 } |
| 1304 | 1304 |
| 1305 | 1305 |
| 1306 ArgumentListNode* Parser::BuildNoSuchMethodArguments( | 1306 ArgumentListNode* Parser::BuildNoSuchMethodArguments( |
| 1307 const String& function_name, | 1307 const String& function_name, |
| 1308 const ArgumentListNode& function_args) { | 1308 const ArgumentListNode& function_args) { |
| 1309 ASSERT(function_args.length() >= 1); // The receiver is the first argument. | 1309 ASSERT(function_args.length() >= 1); // The receiver is the first argument. |
| 1310 const intptr_t args_pos = function_args.token_pos(); | 1310 const intptr_t args_pos = function_args.token_pos(); |
| 1311 ArgumentListNode* arguments = new ArgumentListNode(args_pos); | 1311 ArgumentListNode* arguments = new ArgumentListNode(args_pos); |
| 1312 arguments->Add(function_args.NodeAt(0)); | 1312 arguments->Add(function_args.NodeAt(0)); |
| (...skipping 7228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8541 const_list.SetAt(i, elem->AsLiteralNode()->literal()); | 8541 const_list.SetAt(i, elem->AsLiteralNode()->literal()); |
| 8542 } | 8542 } |
| 8543 const_list ^= const_list.Canonicalize(); | 8543 const_list ^= const_list.Canonicalize(); |
| 8544 const_list.MakeImmutable(); | 8544 const_list.MakeImmutable(); |
| 8545 return new LiteralNode(literal_pos, const_list); | 8545 return new LiteralNode(literal_pos, const_list); |
| 8546 } else { | 8546 } else { |
| 8547 // Factory call at runtime. | 8547 // Factory call at runtime. |
| 8548 String& list_literal_factory_class_name = String::Handle( | 8548 String& list_literal_factory_class_name = String::Handle( |
| 8549 Symbols::ListLiteralFactoryClass()); | 8549 Symbols::ListLiteralFactoryClass()); |
| 8550 const Class& list_literal_factory_class = | 8550 const Class& list_literal_factory_class = |
| 8551 Class::Handle(LookupCoreClass(list_literal_factory_class_name)); | 8551 Class::Handle(LookupCoreImplClass(list_literal_factory_class_name)); |
| 8552 ASSERT(!list_literal_factory_class.IsNull()); | 8552 ASSERT(!list_literal_factory_class.IsNull()); |
| 8553 const String& list_literal_factory_name = | 8553 const String& list_literal_factory_name = |
| 8554 String::Handle(Symbols::ListLiteralFactory()); | 8554 String::Handle(Symbols::ListLiteralFactory()); |
| 8555 const Function& list_literal_factory = Function::ZoneHandle( | 8555 const Function& list_literal_factory = Function::ZoneHandle( |
| 8556 list_literal_factory_class.LookupFactory(list_literal_factory_name)); | 8556 list_literal_factory_class.LookupFactory(list_literal_factory_name)); |
| 8557 ASSERT(!list_literal_factory.IsNull()); | 8557 ASSERT(!list_literal_factory.IsNull()); |
| 8558 if (!type_arguments.IsNull() && | 8558 if (!type_arguments.IsNull() && |
| 8559 !type_arguments.IsInstantiated() && | 8559 !type_arguments.IsInstantiated() && |
| 8560 (current_block_->scope->function_level() > 0)) { | 8560 (current_block_->scope->function_level() > 0)) { |
| 8561 // Make sure that the instantiator is captured. | 8561 // Make sure that the instantiator is captured. |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8766 } else { | 8766 } else { |
| 8767 const Instance& const_instance = Instance::Cast(constructor_result); | 8767 const Instance& const_instance = Instance::Cast(constructor_result); |
| 8768 return new LiteralNode(literal_pos, | 8768 return new LiteralNode(literal_pos, |
| 8769 Instance::ZoneHandle(const_instance.raw())); | 8769 Instance::ZoneHandle(const_instance.raw())); |
| 8770 } | 8770 } |
| 8771 } else { | 8771 } else { |
| 8772 // Factory call at runtime. | 8772 // Factory call at runtime. |
| 8773 String& map_literal_factory_class_name = String::Handle( | 8773 String& map_literal_factory_class_name = String::Handle( |
| 8774 Symbols::MapLiteralFactoryClass()); | 8774 Symbols::MapLiteralFactoryClass()); |
| 8775 const Class& map_literal_factory_class = | 8775 const Class& map_literal_factory_class = |
| 8776 Class::Handle(LookupCoreClass(map_literal_factory_class_name)); | 8776 Class::Handle(LookupCoreImplClass(map_literal_factory_class_name)); |
| 8777 ASSERT(!map_literal_factory_class.IsNull()); | 8777 ASSERT(!map_literal_factory_class.IsNull()); |
| 8778 const String& map_literal_factory_name = | 8778 const String& map_literal_factory_name = |
| 8779 String::Handle(Symbols::MapLiteralFactory()); | 8779 String::Handle(Symbols::MapLiteralFactory()); |
| 8780 const Function& map_literal_factory = Function::ZoneHandle( | 8780 const Function& map_literal_factory = Function::ZoneHandle( |
| 8781 map_literal_factory_class.LookupFactory(map_literal_factory_name)); | 8781 map_literal_factory_class.LookupFactory(map_literal_factory_name)); |
| 8782 ASSERT(!map_literal_factory.IsNull()); | 8782 ASSERT(!map_literal_factory.IsNull()); |
| 8783 if (!map_type_arguments.IsNull() && | 8783 if (!map_type_arguments.IsNull() && |
| 8784 !map_type_arguments.IsInstantiated() && | 8784 !map_type_arguments.IsInstantiated() && |
| 8785 (current_block_->scope->function_level() > 0)) { | 8785 (current_block_->scope->function_level() > 0)) { |
| 8786 // Make sure that the instantiator is captured. | 8786 // Make sure that the instantiator is captured. |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9687 void Parser::SkipQualIdent() { | 9687 void Parser::SkipQualIdent() { |
| 9688 ASSERT(IsIdentifier()); | 9688 ASSERT(IsIdentifier()); |
| 9689 ConsumeToken(); | 9689 ConsumeToken(); |
| 9690 if (CurrentToken() == Token::kPERIOD) { | 9690 if (CurrentToken() == Token::kPERIOD) { |
| 9691 ConsumeToken(); // Consume the kPERIOD token. | 9691 ConsumeToken(); // Consume the kPERIOD token. |
| 9692 ExpectIdentifier("identifier expected after '.'"); | 9692 ExpectIdentifier("identifier expected after '.'"); |
| 9693 } | 9693 } |
| 9694 } | 9694 } |
| 9695 | 9695 |
| 9696 } // namespace dart | 9696 } // namespace dart |
| OLD | NEW |