| 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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 ASSERT(!super_func.IsNull()); | 1358 ASSERT(!super_func.IsNull()); |
| 1359 *is_no_such_method = true; | 1359 *is_no_such_method = true; |
| 1360 } else { | 1360 } else { |
| 1361 *is_no_such_method = false; | 1361 *is_no_such_method = false; |
| 1362 } | 1362 } |
| 1363 CheckFunctionIsCallable(token_pos, super_func); | 1363 CheckFunctionIsCallable(token_pos, super_func); |
| 1364 return super_func.raw(); | 1364 return super_func.raw(); |
| 1365 } | 1365 } |
| 1366 | 1366 |
| 1367 | 1367 |
| 1368 // Lookup class in the corelib implementation which contains various VM | |
| 1369 // helper methods and classes. | |
| 1370 static RawClass* LookupImplClass(const String& class_name) { | |
| 1371 Library& coreimpl = Library::Handle(Library::CoreImplLibrary()); | |
| 1372 return coreimpl.LookupClassAllowPrivate(class_name); | |
| 1373 } | |
| 1374 | |
| 1375 | |
| 1376 // Lookup class in the core lib which also contains various VM | 1368 // Lookup class in the core lib which also contains various VM |
| 1377 // helper methods and classes. Allow look up of private classes. | 1369 // helper methods and classes. Allow look up of private classes. |
| 1378 static RawClass* LookupCoreClass(const String& class_name) { | 1370 static RawClass* LookupCoreClass(const String& class_name) { |
| 1379 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 1371 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
| 1380 String& name = String::Handle(class_name.raw()); | 1372 String& name = String::Handle(class_name.raw()); |
| 1381 if (class_name.CharAt(0) == Scanner::kPrivateIdentifierStart) { | 1373 if (class_name.CharAt(0) == Scanner::kPrivateIdentifierStart) { |
| 1382 // Private identifiers are mangled on a per script basis. | 1374 // Private identifiers are mangled on a per script basis. |
| 1383 name = String::Concat(name, String::Handle(core_lib.private_key())); | 1375 name = String::Concat(name, String::Handle(core_lib.private_key())); |
| 1384 name = Symbols::New(name); | 1376 name = Symbols::New(name); |
| 1385 } | 1377 } |
| (...skipping 7578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8964 } | 8956 } |
| 8965 key_value_array.SetAt(i, arg->AsLiteralNode()->literal()); | 8957 key_value_array.SetAt(i, arg->AsLiteralNode()->literal()); |
| 8966 } | 8958 } |
| 8967 key_value_array ^= key_value_array.Canonicalize(); | 8959 key_value_array ^= key_value_array.Canonicalize(); |
| 8968 key_value_array.MakeImmutable(); | 8960 key_value_array.MakeImmutable(); |
| 8969 | 8961 |
| 8970 // Construct the map object. | 8962 // Construct the map object. |
| 8971 const String& immutable_map_class_name = | 8963 const String& immutable_map_class_name = |
| 8972 String::Handle(Symbols::ImmutableMap()); | 8964 String::Handle(Symbols::ImmutableMap()); |
| 8973 const Class& immutable_map_class = | 8965 const Class& immutable_map_class = |
| 8974 Class::Handle(LookupImplClass(immutable_map_class_name)); | 8966 Class::Handle(LookupCoreClass(immutable_map_class_name)); |
| 8975 ASSERT(!immutable_map_class.IsNull()); | 8967 ASSERT(!immutable_map_class.IsNull()); |
| 8976 ArgumentListNode* constr_args = new ArgumentListNode(TokenPos()); | 8968 ArgumentListNode* constr_args = new ArgumentListNode(TokenPos()); |
| 8977 constr_args->Add(new LiteralNode(literal_pos, key_value_array)); | 8969 constr_args->Add(new LiteralNode(literal_pos, key_value_array)); |
| 8978 const String& constr_name = | 8970 const String& constr_name = |
| 8979 String::Handle(Symbols::ImmutableMapConstructor()); | 8971 String::Handle(Symbols::ImmutableMapConstructor()); |
| 8980 const Function& map_constr = Function::ZoneHandle( | 8972 const Function& map_constr = Function::ZoneHandle( |
| 8981 immutable_map_class.LookupConstructor(constr_name)); | 8973 immutable_map_class.LookupConstructor(constr_name)); |
| 8982 ASSERT(!map_constr.IsNull()); | 8974 ASSERT(!map_constr.IsNull()); |
| 8983 const Object& constructor_result = Object::Handle( | 8975 const Object& constructor_result = Object::Handle( |
| 8984 EvaluateConstConstructorCall(immutable_map_class, | 8976 EvaluateConstConstructorCall(immutable_map_class, |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9974 void Parser::SkipQualIdent() { | 9966 void Parser::SkipQualIdent() { |
| 9975 ASSERT(IsIdentifier()); | 9967 ASSERT(IsIdentifier()); |
| 9976 ConsumeToken(); | 9968 ConsumeToken(); |
| 9977 if (CurrentToken() == Token::kPERIOD) { | 9969 if (CurrentToken() == Token::kPERIOD) { |
| 9978 ConsumeToken(); // Consume the kPERIOD token. | 9970 ConsumeToken(); // Consume the kPERIOD token. |
| 9979 ExpectIdentifier("identifier expected after '.'"); | 9971 ExpectIdentifier("identifier expected after '.'"); |
| 9980 } | 9972 } |
| 9981 } | 9973 } |
| 9982 | 9974 |
| 9983 } // namespace dart | 9975 } // namespace dart |
| OLD | NEW |