OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "vm/hash_table.h" | 7 #include "vm/hash_table.h" |
8 #include "vm/isolate_reload.h" | 8 #include "vm/isolate_reload.h" |
9 #include "vm/log.h" | 9 #include "vm/log.h" |
10 #include "vm/resolver.h" | 10 #include "vm/resolver.h" |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 ASSERT(!owner.IsNull()); | 356 ASSERT(!owner.IsNull()); |
357 if (!owner.IsPatchClass()) { | 357 if (!owner.IsPatchClass()) { |
358 ASSERT(owner.raw() == this->raw()); | 358 ASSERT(owner.raw() == this->raw()); |
359 field.set_owner(patch); | 359 field.set_owner(patch); |
360 } | 360 } |
361 field.ForceDynamicGuardedCidAndLength(); | 361 field.ForceDynamicGuardedCidAndLength(); |
362 } | 362 } |
363 } | 363 } |
364 | 364 |
365 | 365 |
| 366 void Class::MigrateImplicitStaticClosures(IsolateReloadContext* irc, |
| 367 const Class& new_cls) const { |
| 368 const Array& funcs = Array::Handle(functions()); |
| 369 Function& old_func = Function::Handle(); |
| 370 String& selector = String::Handle(); |
| 371 Function& new_func = Function::Handle(); |
| 372 Instance& old_closure = Instance::Handle(); |
| 373 Instance& new_closure = Instance::Handle(); |
| 374 for (intptr_t i = 0; i < funcs.Length(); i++) { |
| 375 old_func ^= funcs.At(i); |
| 376 if (old_func.is_static() && |
| 377 old_func.HasImplicitClosureFunction()) { |
| 378 selector = old_func.name(); |
| 379 new_func = new_cls.LookupFunction(selector); |
| 380 if (!new_func.IsNull() && new_func.is_static()) { |
| 381 old_func = old_func.ImplicitClosureFunction(); |
| 382 old_closure = old_func.ImplicitStaticClosure(); |
| 383 new_func = new_func.ImplicitClosureFunction(); |
| 384 new_closure = new_func.ImplicitStaticClosure(); |
| 385 irc->AddBecomeMapping(old_closure, new_closure); |
| 386 } |
| 387 } |
| 388 } |
| 389 } |
| 390 |
| 391 |
366 class EnumClassConflict : public ClassReasonForCancelling { | 392 class EnumClassConflict : public ClassReasonForCancelling { |
367 public: | 393 public: |
368 EnumClassConflict(const Class& from, const Class& to) | 394 EnumClassConflict(const Class& from, const Class& to) |
369 : ClassReasonForCancelling(from, to) { } | 395 : ClassReasonForCancelling(from, to) { } |
370 | 396 |
371 RawString* ToString() { | 397 RawString* ToString() { |
372 return String::NewFormatted( | 398 return String::NewFormatted( |
373 from_.is_enum_class() | 399 from_.is_enum_class() |
374 ? "Enum class cannot be redefined to be a non-enum class: %s" | 400 ? "Enum class cannot be redefined to be a non-enum class: %s" |
375 : "Class cannot be redefined to be a enum class: %s", | 401 : "Class cannot be redefined to be a enum class: %s", |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 } | 721 } |
696 ClearAndSetStaticTarget(new_target); | 722 ClearAndSetStaticTarget(new_target); |
697 } else { | 723 } else { |
698 ClearWithSentinel(); | 724 ClearWithSentinel(); |
699 } | 725 } |
700 } | 726 } |
701 | 727 |
702 #endif // !PRODUCT | 728 #endif // !PRODUCT |
703 | 729 |
704 } // namespace dart. | 730 } // namespace dart. |
OLD | NEW |