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

Unified Diff: runtime/vm/object.cc

Issue 23619026: Simplify VM internal representation of a mixin application clause (MixinAppType (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 27361)
+++ runtime/vm/object.cc (working copy)
@@ -11593,13 +11593,33 @@
}
+intptr_t MixinAppType::token_pos() const {
+ return Class::Handle(MixinAppAt(0)).token_pos();
+}
+
+
+intptr_t MixinAppType::Depth() const {
+ const Array& mixin_apps = Array::Handle(mixins());
+ return mixin_apps.Length();
+}
+
+
RawString* MixinAppType::Name() const {
- return String::New("MixinApplication");
+ return String::New("MixinAppType");
}
const char* MixinAppType::ToCString() const {
- return "MixinAppType";
+ const char* format = "MixinAppType: super type: %s; first mixin app: %s";
+ const char* super_type_cstr = String::Handle(AbstractType::Handle(
+ SuperType()).Name()).ToCString();
+ const char* first_mixin_app_cstr = String::Handle(Class::Handle(
+ MixinAppAt(0)).Name()).ToCString();
+ intptr_t len = OS::SNPrint(
+ NULL, 0, format, super_type_cstr, first_mixin_app_cstr) + 1;
+ char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
+ OS::SNPrint(chars, len, format, super_type_cstr, first_mixin_app_cstr);
+ return chars;
}
@@ -11608,16 +11628,23 @@
}
-void MixinAppType::set_super_type(const AbstractType& value) const {
- StorePointer(&raw_ptr()->super_type_, value.raw());
+RawAbstractType* MixinAppType::SuperType() const {
+ return Class::Handle(MixinAppAt(0)).super_type();
}
-void MixinAppType::set_mixin_types(const Array& value) const {
- StorePointer(&raw_ptr()->mixin_types_, value.raw());
+RawClass* MixinAppType::MixinAppAt(intptr_t depth) const {
+ Class& mixin_app = Class::Handle();
+ mixin_app ^= Array::Handle(mixins()).At(depth);
+ return mixin_app.raw();
}
+void MixinAppType::set_mixins(const Array& value) const {
+ StorePointer(&raw_ptr()->mixins_, value.raw());
+}
+
+
RawMixinAppType* MixinAppType::New() {
ASSERT(Isolate::Current()->object_store()->mixin_app_type_class() !=
Class::null());
@@ -11630,11 +11657,9 @@
}
-RawMixinAppType* MixinAppType::New(const AbstractType& super_type,
- const Array& mixin_types) {
+RawMixinAppType* MixinAppType::New(const Array& mixins) {
const MixinAppType& result = MixinAppType::Handle(MixinAppType::New());
- result.set_super_type(super_type);
- result.set_mixin_types(mixin_types);
+ result.set_mixins(mixins);
return result.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