| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/class_finalizer.h" | 5 #include "vm/class_finalizer.h" |
| 6 | 6 |
| 7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/heap.h" | 8 #include "vm/heap.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 } | 1408 } |
| 1409 | 1409 |
| 1410 | 1410 |
| 1411 void ClassFinalizer::ApplyMixinTypes(const Class& cls) { | 1411 void ClassFinalizer::ApplyMixinTypes(const Class& cls) { |
| 1412 const Type& mixin_type = Type::Handle(cls.mixin()); | 1412 const Type& mixin_type = Type::Handle(cls.mixin()); |
| 1413 ASSERT(!mixin_type.IsNull()); | 1413 ASSERT(!mixin_type.IsNull()); |
| 1414 ASSERT(mixin_type.HasResolvedTypeClass()); | 1414 ASSERT(mixin_type.HasResolvedTypeClass()); |
| 1415 const Class& mixin_cls = Class::Handle(mixin_type.type_class()); | 1415 const Class& mixin_cls = Class::Handle(mixin_type.type_class()); |
| 1416 | 1416 |
| 1417 if (FLAG_trace_class_finalization) { | 1417 if (FLAG_trace_class_finalization) { |
| 1418 OS::Print("Applying mixin type '%s' to '%s' at pos %"Pd"\n", | 1418 OS::Print("Applying mixin type '%s' to '%s' at pos %" Pd "\n", |
| 1419 String::Handle(mixin_type.Name()).ToCString(), | 1419 String::Handle(mixin_type.Name()).ToCString(), |
| 1420 cls.ToCString(), | 1420 cls.ToCString(), |
| 1421 cls.token_pos()); | 1421 cls.token_pos()); |
| 1422 } | 1422 } |
| 1423 | 1423 |
| 1424 // Check that the super class of the mixin class is extending | 1424 // Check that the super class of the mixin class is extending |
| 1425 // class Object. | 1425 // class Object. |
| 1426 const AbstractType& mixin_super_type = | 1426 const AbstractType& mixin_super_type = |
| 1427 AbstractType::Handle(mixin_cls.super_type()); | 1427 AbstractType::Handle(mixin_cls.super_type()); |
| 1428 if (!mixin_super_type.IsObjectType()) { | 1428 if (!mixin_super_type.IsObjectType()) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 | 1502 |
| 1503 void ClassFinalizer::ApplyMixin(const Class& cls) { | 1503 void ClassFinalizer::ApplyMixin(const Class& cls) { |
| 1504 Isolate* isolate = Isolate::Current(); | 1504 Isolate* isolate = Isolate::Current(); |
| 1505 const Type& mixin_type = Type::Handle(isolate, cls.mixin()); | 1505 const Type& mixin_type = Type::Handle(isolate, cls.mixin()); |
| 1506 ASSERT(!mixin_type.IsNull()); | 1506 ASSERT(!mixin_type.IsNull()); |
| 1507 ASSERT(mixin_type.HasResolvedTypeClass()); | 1507 ASSERT(mixin_type.HasResolvedTypeClass()); |
| 1508 const Class& mixin_cls = Class::Handle(isolate, mixin_type.type_class()); | 1508 const Class& mixin_cls = Class::Handle(isolate, mixin_type.type_class()); |
| 1509 mixin_cls.EnsureIsFinalized(isolate); | 1509 mixin_cls.EnsureIsFinalized(isolate); |
| 1510 | 1510 |
| 1511 if (FLAG_trace_class_finalization) { | 1511 if (FLAG_trace_class_finalization) { |
| 1512 OS::Print("Applying mixin '%s' to '%s' at pos %"Pd"\n", | 1512 OS::Print("Applying mixin '%s' to '%s' at pos %" Pd "\n", |
| 1513 String::Handle(mixin_cls.Name()).ToCString(), | 1513 String::Handle(mixin_cls.Name()).ToCString(), |
| 1514 cls.ToCString(), | 1514 cls.ToCString(), |
| 1515 cls.token_pos()); | 1515 cls.token_pos()); |
| 1516 } | 1516 } |
| 1517 | 1517 |
| 1518 const GrowableObjectArray& cloned_funcs = | 1518 const GrowableObjectArray& cloned_funcs = |
| 1519 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); | 1519 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); |
| 1520 | 1520 |
| 1521 CreateForwardingConstructors(cls, cloned_funcs); | 1521 CreateForwardingConstructors(cls, cloned_funcs); |
| 1522 | 1522 |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2308 expected_name ^= String::New("_offset"); | 2308 expected_name ^= String::New("_offset"); |
| 2309 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 2309 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
| 2310 field ^= fields_array.At(2); | 2310 field ^= fields_array.At(2); |
| 2311 ASSERT(field.Offset() == TypedDataView::length_offset()); | 2311 ASSERT(field.Offset() == TypedDataView::length_offset()); |
| 2312 name ^= field.name(); | 2312 name ^= field.name(); |
| 2313 ASSERT(name.Equals("length")); | 2313 ASSERT(name.Equals("length")); |
| 2314 #endif | 2314 #endif |
| 2315 } | 2315 } |
| 2316 | 2316 |
| 2317 } // namespace dart | 2317 } // namespace dart |
| OLD | NEW |