Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Unified Diff: runtime/vm/object.cc

Issue 23453024: Keep track of type parameter processing in mixin application classes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 27156)
+++ runtime/vm/object.cc (working copy)
@@ -1640,14 +1640,6 @@
}
-void Class::set_class_state(RawClass::ClassState state) const {
- ASSERT((state == RawClass::kAllocated) ||
- (state == RawClass::kPreFinalized) ||
- (state == RawClass::kFinalized));
- set_state_bits(StateBits::update(state, raw_ptr()->state_bits_));
-}
-
-
void Class::set_state_bits(intptr_t bits) const {
raw_ptr()->state_bits_ = static_cast<uint16_t>(bits);
}
@@ -1664,6 +1656,9 @@
intptr_t Class::NumTypeParameters() const {
+ if (IsMixinApplication() && !is_mixin_type_applied()) {
+ ClassFinalizer::ApplyMixinType(*this);
+ }
if (type_parameters() == TypeArguments::null()) {
return 0;
}
@@ -1674,7 +1669,8 @@
intptr_t Class::NumTypeArguments() const {
// To work properly, this call requires the super class of this class to be
- // resolved, which is checked by the SuperClass() call.
+ // resolved, which is checked by the type_class() call on the super type.
+ // Note that calling type_class() on a MixinAppType fails.
Isolate* isolate = Isolate::Current();
ReusableHandleScope reused_handles(isolate);
Class& cls = reused_handles.ClassHandle();
@@ -1692,7 +1688,9 @@
cls = signature_fun.Owner();
}
}
- if (cls.type_parameters() != TypeArguments::null()) {
+ // Calling NumTypeParameters() on a mixin application class will setup the
+ // type parameters if not already done.
+ if (cls.NumTypeParameters() > 0) {
type_params ^= cls.type_parameters();
num_type_args += type_params.Length();
}
@@ -2354,17 +2352,22 @@
}
+void Class::set_is_mixin_type_applied() const {
+ set_state_bits(MixinTypeAppliedBit::update(true, raw_ptr()->state_bits_));
+}
+
+
void Class::set_is_finalized() const {
ASSERT(!is_finalized());
- set_state_bits(StateBits::update(RawClass::kFinalized,
- raw_ptr()->state_bits_));
+ set_state_bits(ClassFinalizedBits::update(RawClass::kFinalized,
+ raw_ptr()->state_bits_));
}
void Class::set_is_prefinalized() const {
ASSERT(!is_finalized());
- set_state_bits(StateBits::update(RawClass::kPreFinalized,
- raw_ptr()->state_bits_));
+ set_state_bits(ClassFinalizedBits::update(RawClass::kPreFinalized,
+ raw_ptr()->state_bits_));
}
@@ -2392,6 +2395,11 @@
}
+bool Class::IsMixinApplication() const {
+ return mixin() != Type::null();
+}
+
+
void Class::set_patch_class(const Class& cls) const {
ASSERT(patch_class() == Class::null());
StorePointer(&raw_ptr()->patch_class_, cls.raw());
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698