| 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/assembler.h" | 5 #include "vm/assembler.h" |
| 6 #include "vm/bigint_operations.h" | 6 #include "vm/bigint_operations.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3245 | 3245 |
| 3246 static RawField* GetField(const Class& cls, const char* name) { | 3246 static RawField* GetField(const Class& cls, const char* name) { |
| 3247 const Field& field = | 3247 const Field& field = |
| 3248 Field::Handle(cls.LookupField(String::Handle(String::New(name)))); | 3248 Field::Handle(cls.LookupField(String::Handle(String::New(name)))); |
| 3249 EXPECT(!field.IsNull()); | 3249 EXPECT(!field.IsNull()); |
| 3250 return field.raw(); | 3250 return field.raw(); |
| 3251 } | 3251 } |
| 3252 | 3252 |
| 3253 | 3253 |
| 3254 static RawClass* GetClass(const Library& lib, const char* name) { | 3254 static RawClass* GetClass(const Library& lib, const char* name) { |
| 3255 String& ambiguity_error_msg = String::Handle(); | |
| 3256 const Class& cls = Class::Handle( | 3255 const Class& cls = Class::Handle( |
| 3257 lib.LookupClass(String::Handle(Symbols::New(name)), | 3256 lib.LookupClass(String::Handle(Symbols::New(name)))); |
| 3258 &ambiguity_error_msg)); | |
| 3259 EXPECT(!cls.IsNull()); // No ambiguity error expected. | 3257 EXPECT(!cls.IsNull()); // No ambiguity error expected. |
| 3260 return cls.raw(); | 3258 return cls.raw(); |
| 3261 } | 3259 } |
| 3262 | 3260 |
| 3263 | 3261 |
| 3264 static void PrintMetadata(const char* name, const Object& data) { | 3262 static void PrintMetadata(const char* name, const Object& data) { |
| 3265 if (data.IsError()) { | 3263 if (data.IsError()) { |
| 3266 OS::Print("Error in metadata evaluation for %s: '%s'\n", | 3264 OS::Print("Error in metadata evaluation for %s: '%s'\n", |
| 3267 name, | 3265 name, |
| 3268 Error::Cast(data).ToErrorCString()); | 3266 Error::Cast(data).ToErrorCString()); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3389 " return a > 1 ? a + 1 : a;\n" | 3387 " return a > 1 ? a + 1 : a;\n" |
| 3390 " }\n" | 3388 " }\n" |
| 3391 "}"; | 3389 "}"; |
| 3392 TestCase::LoadTestScript(kScriptChars, NULL); | 3390 TestCase::LoadTestScript(kScriptChars, NULL); |
| 3393 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 3391 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
| 3394 const String& name = String::Handle(String::New(TestCase::url())); | 3392 const String& name = String::Handle(String::New(TestCase::url())); |
| 3395 const Library& lib = Library::Handle(Library::LookupLibrary(name)); | 3393 const Library& lib = Library::Handle(Library::LookupLibrary(name)); |
| 3396 EXPECT(!lib.IsNull()); | 3394 EXPECT(!lib.IsNull()); |
| 3397 | 3395 |
| 3398 const Class& class_a = Class::Handle( | 3396 const Class& class_a = Class::Handle( |
| 3399 lib.LookupClass(String::Handle(Symbols::New("A")), NULL)); | 3397 lib.LookupClass(String::Handle(Symbols::New("A")))); |
| 3400 const Class& class_b = Class::Handle( | 3398 const Class& class_b = Class::Handle( |
| 3401 lib.LookupClass(String::Handle(Symbols::New("B")), NULL)); | 3399 lib.LookupClass(String::Handle(Symbols::New("B")))); |
| 3402 const Function& a_test1 = | 3400 const Function& a_test1 = |
| 3403 Function::Handle(GetStaticFunction(class_a, "test1")); | 3401 Function::Handle(GetStaticFunction(class_a, "test1")); |
| 3404 const Function& b_test1 = | 3402 const Function& b_test1 = |
| 3405 Function::Handle(GetStaticFunction(class_b, "test1")); | 3403 Function::Handle(GetStaticFunction(class_b, "test1")); |
| 3406 const Function& a_test2 = | 3404 const Function& a_test2 = |
| 3407 Function::Handle(GetStaticFunction(class_a, "test2")); | 3405 Function::Handle(GetStaticFunction(class_a, "test2")); |
| 3408 const Function& a_test3 = | 3406 const Function& a_test3 = |
| 3409 Function::Handle(GetStaticFunction(class_a, "test3")); | 3407 Function::Handle(GetStaticFunction(class_a, "test3")); |
| 3410 const Function& a_test4 = | 3408 const Function& a_test4 = |
| 3411 Function::Handle(GetStaticFunction(class_a, "test4")); | 3409 Function::Handle(GetStaticFunction(class_a, "test4")); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3452 cls = Object::dynamic_class(); | 3450 cls = Object::dynamic_class(); |
| 3453 array = cls.fields(); | 3451 array = cls.fields(); |
| 3454 EXPECT(!array.IsNull()); | 3452 EXPECT(!array.IsNull()); |
| 3455 EXPECT(array.IsArray()); | 3453 EXPECT(array.IsArray()); |
| 3456 array = cls.functions(); | 3454 array = cls.functions(); |
| 3457 EXPECT(!array.IsNull()); | 3455 EXPECT(!array.IsNull()); |
| 3458 EXPECT(array.IsArray()); | 3456 EXPECT(array.IsArray()); |
| 3459 } | 3457 } |
| 3460 | 3458 |
| 3461 } // namespace dart | 3459 } // namespace dart |
| OLD | NEW |