| 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 "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 274 |
| 275 // No fields, functions, or super type for the OneFieldClass. | 275 // No fields, functions, or super type for the OneFieldClass. |
| 276 EXPECT_EQ(Array::Handle(empty_class.fields()).Length(), 0); | 276 EXPECT_EQ(Array::Handle(empty_class.fields()).Length(), 0); |
| 277 EXPECT_EQ(Array::Handle(empty_class.functions()).Length(), 0); | 277 EXPECT_EQ(Array::Handle(empty_class.functions()).Length(), 0); |
| 278 EXPECT_EQ(empty_class.super_type(), AbstractType::null()); | 278 EXPECT_EQ(empty_class.super_type(), AbstractType::null()); |
| 279 ClassFinalizer::FinalizeTypesInClass(one_field_class); | 279 ClassFinalizer::FinalizeTypesInClass(one_field_class); |
| 280 | 280 |
| 281 const Array& one_fields = Array::Handle(Array::New(1)); | 281 const Array& one_fields = Array::Handle(Array::New(1)); |
| 282 const String& field_name = String::Handle(Symbols::New("the_field")); | 282 const String& field_name = String::Handle(Symbols::New("the_field")); |
| 283 const Field& field = Field::Handle( | 283 const Field& field = Field::Handle( |
| 284 Field::New(field_name, false, false, false, false, one_field_class, 0)); | 284 Field::New(field_name, false, false, false, true, one_field_class, 0)); |
| 285 one_fields.SetAt(0, field); | 285 one_fields.SetAt(0, field); |
| 286 one_field_class.SetFields(one_fields); | 286 one_field_class.SetFields(one_fields); |
| 287 one_field_class.Finalize(); | 287 one_field_class.Finalize(); |
| 288 intptr_t header_size = sizeof(RawObject); | 288 intptr_t header_size = sizeof(RawObject); |
| 289 EXPECT_EQ(Utils::RoundUp((header_size + (1 * kWordSize)), kObjectAlignment), | 289 EXPECT_EQ(Utils::RoundUp((header_size + (1 * kWordSize)), kObjectAlignment), |
| 290 one_field_class.instance_size()); | 290 one_field_class.instance_size()); |
| 291 EXPECT_EQ(header_size, field.Offset()); | 291 EXPECT_EQ(header_size, field.Offset()); |
| 292 EXPECT(!one_field_class.is_implemented()); | 292 EXPECT(!one_field_class.is_implemented()); |
| 293 one_field_class.set_is_implemented(); | 293 one_field_class.set_is_implemented(); |
| 294 EXPECT(one_field_class.is_implemented()); | 294 EXPECT(one_field_class.is_implemented()); |
| (...skipping 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2984 const Class& cls = Class::Handle( | 2984 const Class& cls = Class::Handle( |
| 2985 CreateDummyClass(class_name, Script::Handle())); | 2985 CreateDummyClass(class_name, Script::Handle())); |
| 2986 return cls.raw(); | 2986 return cls.raw(); |
| 2987 } | 2987 } |
| 2988 | 2988 |
| 2989 | 2989 |
| 2990 static RawField* CreateTestField(const char* name) { | 2990 static RawField* CreateTestField(const char* name) { |
| 2991 const Class& cls = Class::Handle(CreateTestClass("global:")); | 2991 const Class& cls = Class::Handle(CreateTestClass("global:")); |
| 2992 const String& field_name = String::Handle(Symbols::New(name)); | 2992 const String& field_name = String::Handle(Symbols::New(name)); |
| 2993 const Field& field = | 2993 const Field& field = |
| 2994 Field::Handle(Field::New(field_name, true, false, false, false, cls, 0)); | 2994 Field::Handle(Field::New(field_name, true, false, false, true, cls, 0)); |
| 2995 return field.raw(); | 2995 return field.raw(); |
| 2996 } | 2996 } |
| 2997 | 2997 |
| 2998 | 2998 |
| 2999 TEST_CASE(ClassDictionaryIterator) { | 2999 TEST_CASE(ClassDictionaryIterator) { |
| 3000 Class& ae66 = Class::ZoneHandle(CreateTestClass("Ae6/6")); | 3000 Class& ae66 = Class::ZoneHandle(CreateTestClass("Ae6/6")); |
| 3001 Class& re44 = Class::ZoneHandle(CreateTestClass("Re4/4")); | 3001 Class& re44 = Class::ZoneHandle(CreateTestClass("Re4/4")); |
| 3002 Field& ce68 = Field::ZoneHandle(CreateTestField("Ce6/8")); | 3002 Field& ce68 = Field::ZoneHandle(CreateTestField("Ce6/8")); |
| 3003 Field& tee = Field::ZoneHandle(CreateTestField("TEE")); | 3003 Field& tee = Field::ZoneHandle(CreateTestField("TEE")); |
| 3004 String& url = String::ZoneHandle(String::New("SBB")); | 3004 String& url = String::ZoneHandle(String::New("SBB")); |
| (...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4733 EXPECT(iterator.MoveNext()); | 4733 EXPECT(iterator.MoveNext()); |
| 4734 object = iterator.CurrentKey(); | 4734 object = iterator.CurrentKey(); |
| 4735 EXPECT_STREQ("z", object.ToCString()); | 4735 EXPECT_STREQ("z", object.ToCString()); |
| 4736 object = iterator.CurrentValue(); | 4736 object = iterator.CurrentValue(); |
| 4737 EXPECT_STREQ("5", object.ToCString()); | 4737 EXPECT_STREQ("5", object.ToCString()); |
| 4738 | 4738 |
| 4739 EXPECT(!iterator.MoveNext()); | 4739 EXPECT(!iterator.MoveNext()); |
| 4740 } | 4740 } |
| 4741 | 4741 |
| 4742 } // namespace dart | 4742 } // namespace dart |
| OLD | NEW |