| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/assert.h" | 5 #include "vm/assert.h" |
| 6 #include "vm/assembler.h" | 6 #include "vm/assembler.h" |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" |
| 8 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 9 #include "vm/object.h" | 10 #include "vm/object.h" |
| 10 #include "vm/object_store.h" | 11 #include "vm/object_store.h" |
| 11 #include "vm/unit_test.h" | 12 #include "vm/unit_test.h" |
| 12 | 13 |
| 13 namespace dart { | 14 namespace dart { |
| 14 | 15 |
| 15 TEST_CASE(Class) { | 16 TEST_CASE(Class) { |
| 16 // Allocate the class first. | 17 // Allocate the class first. |
| 17 const String& class_name = String::Handle(String::NewSymbol("MyClass")); | 18 const String& class_name = String::Handle(String::NewSymbol("MyClass")); |
| (...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1737 const Context& context = Context::Handle(Context::New(0)); | 1738 const Context& context = Context::Handle(Context::New(0)); |
| 1738 Function& parent = Function::Handle(); | 1739 Function& parent = Function::Handle(); |
| 1739 const String& parent_name = String::Handle(String::NewSymbol("foo_papa")); | 1740 const String& parent_name = String::Handle(String::NewSymbol("foo_papa")); |
| 1740 parent = Function::New(parent_name, RawFunction::kFunction, false, false, 0); | 1741 parent = Function::New(parent_name, RawFunction::kFunction, false, false, 0); |
| 1741 functions.SetAt(0, parent); | 1742 functions.SetAt(0, parent); |
| 1742 cls.SetFunctions(functions); | 1743 cls.SetFunctions(functions); |
| 1743 | 1744 |
| 1744 Function& function = Function::Handle(); | 1745 Function& function = Function::Handle(); |
| 1745 const String& function_name = String::Handle(String::NewSymbol("foo")); | 1746 const String& function_name = String::Handle(String::NewSymbol("foo")); |
| 1746 function = Function::NewClosureFunction(function_name, parent, 0); | 1747 function = Function::NewClosureFunction(function_name, parent, 0); |
| 1748 // Postpone signature class finalization. |
| 1749 ClassFinalizer::ExpectPendingClasses(); |
| 1747 const Class& signature_class = Class::Handle( | 1750 const Class& signature_class = Class::Handle( |
| 1748 Class::NewSignatureClass(function_name, function, script)); | 1751 Class::NewSignatureClass(function_name, function, script)); |
| 1749 const Closure& closure = Closure::Handle(Closure::New(function, context)); | 1752 const Closure& closure = Closure::Handle(Closure::New(function, context)); |
| 1750 const Class& closure_class = Class::Handle(closure.clazz()); | 1753 const Class& closure_class = Class::Handle(closure.clazz()); |
| 1751 EXPECT(closure_class.IsSignatureClass()); | 1754 EXPECT(closure_class.IsSignatureClass()); |
| 1752 EXPECT(closure_class.IsCanonicalSignatureClass()); | 1755 EXPECT(closure_class.IsCanonicalSignatureClass()); |
| 1753 EXPECT_EQ(closure_class.raw(), signature_class.raw()); | 1756 EXPECT_EQ(closure_class.raw(), signature_class.raw()); |
| 1754 const Function& signature_function = | 1757 const Function& signature_function = |
| 1755 Function::Handle(signature_class.signature_function()); | 1758 Function::Handle(signature_class.signature_function()); |
| 1756 EXPECT_EQ(signature_function.raw(), function.raw()); | 1759 EXPECT_EQ(signature_function.raw(), function.raw()); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1949 cls = iterator.GetNextClass(); | 1952 cls = iterator.GetNextClass(); |
| 1950 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw())); | 1953 ASSERT((cls.raw() == ae66.raw()) || (cls.raw() == re44.raw())); |
| 1951 count++; | 1954 count++; |
| 1952 } | 1955 } |
| 1953 ASSERT(count == 2); | 1956 ASSERT(count == 2); |
| 1954 } | 1957 } |
| 1955 | 1958 |
| 1956 #endif // TARGET_ARCH_IA32. | 1959 #endif // TARGET_ARCH_IA32. |
| 1957 | 1960 |
| 1958 } // namespace dart | 1961 } // namespace dart |
| OLD | NEW |