sub _superclasses_updated {
my $self = shift;
$self->update_meta_instance_dependencies();
+ # keep strong references to all our parents, so they don't disappear if
+ # they are anon classes and don't have any direct instances
+ $self->_superclass_metas(
+ map { Class::MOP::class_of($_) } $self->superclasses
+ );
+}
+
+sub _superclass_metas {
+ my $self = shift;
+ $self->{_superclass_metas} = [@_];
}
sub subclasses {
invalidate_meta_instances invalidate_meta_instance
superclasses subclasses direct_subclasses class_precedence_list
- linearized_isa _superclasses_updated
+ linearized_isa _superclasses_updated _superclass_metas
alias_method get_all_method_names get_all_methods compute_all_applicable_methods
find_method_by_name find_all_methods_by_name find_next_method_by_name
superclasses => [Class::MOP::Class->create_anon_class->name],
);
my @superclasses = $submeta->superclasses;
- { local $TODO = "anon class ancestry isn't preserved yet";
ok(Class::MOP::class_of($superclasses[0]),
"superclasses are kept alive by their subclasses");
- }
}
{