Chromium Code Reviews| 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 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1360 ASSERT(!super_func.IsNull()); | 1360 ASSERT(!super_func.IsNull()); |
| 1361 *is_no_such_method = true; | 1361 *is_no_such_method = true; |
| 1362 } else { | 1362 } else { |
| 1363 *is_no_such_method = false; | 1363 *is_no_such_method = false; |
| 1364 } | 1364 } |
| 1365 CheckFunctionIsCallable(token_pos, super_func); | 1365 CheckFunctionIsCallable(token_pos, super_func); |
| 1366 return super_func.raw(); | 1366 return super_func.raw(); |
| 1367 } | 1367 } |
| 1368 | 1368 |
| 1369 | 1369 |
| 1370 // Lookup class in the corelib implementation which contains various VM | |
| 1371 // helper methods and classes. | |
| 1372 static RawClass* LookupImplClass(const String& class_name) { | |
| 1373 Library& coreimpl = Library::Handle(Library::CoreImplLibrary()); | |
| 1374 return coreimpl.LookupClassAllowPrivate(class_name); | |
| 1375 } | |
| 1376 | |
| 1377 | |
| 1378 // Lookup class in the core lib which also contains various VM | 1370 // Lookup class in the core lib which also contains various VM |
| 1379 // helper methods and classes. Allow look up of private classes. | 1371 // helper methods and classes. Allow look up of private classes. |
| 1380 static RawClass* LookupCoreClass(const String& class_name) { | 1372 static RawClass* LookupCoreClass(const String& class_name) { |
| 1381 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 1373 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
| 1382 String& name = String::Handle(class_name.raw()); | 1374 String& name = String::Handle(class_name.raw()); |
| 1383 if (class_name.CharAt(0) == Scanner::kPrivateIdentifierStart) { | 1375 if (class_name.CharAt(0) == Scanner::kPrivateIdentifierStart) { |
| 1384 // Private identifiers are mangled on a per script basis. | 1376 // Private identifiers are mangled on a per script basis. |
| 1385 name = String::Concat(name, String::Handle(core_lib.private_key())); | 1377 name = String::Concat(name, String::Handle(core_lib.private_key())); |
| 1386 name = Symbols::New(name); | 1378 name = Symbols::New(name); |
| 1387 } | 1379 } |
| (...skipping 7626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9014 } | 9006 } |
| 9015 key_value_array.SetAt(i, arg->AsLiteralNode()->literal()); | 9007 key_value_array.SetAt(i, arg->AsLiteralNode()->literal()); |
| 9016 } | 9008 } |
| 9017 key_value_array ^= key_value_array.Canonicalize(); | 9009 key_value_array ^= key_value_array.Canonicalize(); |
| 9018 key_value_array.MakeImmutable(); | 9010 key_value_array.MakeImmutable(); |
| 9019 | 9011 |
| 9020 // Construct the map object. | 9012 // Construct the map object. |
| 9021 const String& immutable_map_class_name = | 9013 const String& immutable_map_class_name = |
| 9022 String::Handle(Symbols::ImmutableMap()); | 9014 String::Handle(Symbols::ImmutableMap()); |
| 9023 const Class& immutable_map_class = | 9015 const Class& immutable_map_class = |
| 9024 Class::Handle(LookupImplClass(immutable_map_class_name)); | 9016 Class::Handle(LookupCoreClass(immutable_map_class_name)); |
|
Ivan Posva
2012/11/13 18:26:28
I do not see the immutable map class moving from c
Anders Johnsen
2012/11/13 18:40:26
Agreed, and this is something that I didn't detect
| |
| 9025 ASSERT(!immutable_map_class.IsNull()); | 9017 ASSERT(!immutable_map_class.IsNull()); |
| 9026 ArgumentListNode* constr_args = new ArgumentListNode(TokenPos()); | 9018 ArgumentListNode* constr_args = new ArgumentListNode(TokenPos()); |
| 9027 constr_args->Add(new LiteralNode(literal_pos, key_value_array)); | 9019 constr_args->Add(new LiteralNode(literal_pos, key_value_array)); |
| 9028 const String& constr_name = | 9020 const String& constr_name = |
| 9029 String::Handle(Symbols::ImmutableMapConstructor()); | 9021 String::Handle(Symbols::ImmutableMapConstructor()); |
| 9030 const Function& map_constr = Function::ZoneHandle( | 9022 const Function& map_constr = Function::ZoneHandle( |
| 9031 immutable_map_class.LookupConstructor(constr_name)); | 9023 immutable_map_class.LookupConstructor(constr_name)); |
| 9032 ASSERT(!map_constr.IsNull()); | 9024 ASSERT(!map_constr.IsNull()); |
| 9033 const Object& constructor_result = Object::Handle( | 9025 const Object& constructor_result = Object::Handle( |
| 9034 EvaluateConstConstructorCall(immutable_map_class, | 9026 EvaluateConstConstructorCall(immutable_map_class, |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10024 void Parser::SkipQualIdent() { | 10016 void Parser::SkipQualIdent() { |
| 10025 ASSERT(IsIdentifier()); | 10017 ASSERT(IsIdentifier()); |
| 10026 ConsumeToken(); | 10018 ConsumeToken(); |
| 10027 if (CurrentToken() == Token::kPERIOD) { | 10019 if (CurrentToken() == Token::kPERIOD) { |
| 10028 ConsumeToken(); // Consume the kPERIOD token. | 10020 ConsumeToken(); // Consume the kPERIOD token. |
| 10029 ExpectIdentifier("identifier expected after '.'"); | 10021 ExpectIdentifier("identifier expected after '.'"); |
| 10030 } | 10022 } |
| 10031 } | 10023 } |
| 10032 | 10024 |
| 10033 } // namespace dart | 10025 } // namespace dart |
| OLD | NEW |