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

Unified Diff: runtime/vm/class_finalizer.cc

Issue 12340085: Progress in generic mixins (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_finalizer.cc
===================================================================
--- runtime/vm/class_finalizer.cc (revision 19079)
+++ runtime/vm/class_finalizer.cc (working copy)
@@ -1121,6 +1121,31 @@
class_name.ToCString());
}
+ // Copy the type parameters of the mixin class to the mixin
+ // application class.
+ const int num_type_parameters = mixin_cls.NumTypeParameters();
+ if (num_type_parameters > 0) {
+ ASSERT(cls.NumTypeParameters() == 0);
+ const TypeArguments& type_params =
+ TypeArguments::Handle(mixin_cls.type_parameters());
+ const TypeArguments& cloned_type_params =
+ TypeArguments::Handle(TypeArguments::New(num_type_parameters));
+ ASSERT(!type_params.IsNull());
+ TypeParameter& param = TypeParameter::Handle();
+ TypeParameter& cloned_param = TypeParameter::Handle();
+ String& param_name = String::Handle();
+ AbstractType& param_bound = AbstractType::Handle();
+ for (int i = 0; i < num_type_parameters; i++) {
+ param ^= type_params.TypeAt(i);
+ param_name = param.name();
+ param_bound = param.bound();
+ cloned_param = TypeParameter::New(
+ cls, i, param_name, param_bound, param.token_pos());
+ cloned_type_params.SetTypeAt(i, cloned_param);
+ }
+ cls.set_type_parameters(cloned_type_params);
+ }
+
const GrowableObjectArray& cloned_funcs =
GrowableObjectArray::Handle(GrowableObjectArray::New());
Array& functions = Array::Handle();
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698