simplify
Jesse Luehrs [Mon, 27 Sep 2010 06:41:09 +0000 (01:41 -0500)]
lib/Class/MOP/Class.pm
t/010_self_introspection.t

index 6981fd8..c361d76 100644 (file)
@@ -332,37 +332,31 @@ sub _fix_metaclass_incompatibility {
 
 sub _can_fix_metaclass_incompatibility {
     my $self = shift;
-    return $self->_can_fix_metaclass_incompatibility_by_subclassing(@_);
-}
-
-sub _can_fix_metaclass_incompatibility_by_subclassing {
-    my $self = shift;
     my ($super_meta) = @_;
 
-    return 1 if $self->_can_fix_class_metaclass_incompatibility_by_subclassing($super_meta);
+    return 1 if $self->_class_metaclass_can_be_made_compatible($super_meta);
 
     my %base_metaclass = $self->_base_metaclasses;
     for my $metaclass_type (keys %base_metaclass) {
-        return 1 if $self->_can_fix_single_metaclass_incompatibility_by_subclassing($metaclass_type, $super_meta);
+        return 1 if $self->_single_metaclass_can_be_made_compatible($super_meta, $metaclass_type);
     }
 
     return;
 }
 
-sub _can_fix_class_metaclass_incompatibility_by_subclassing {
+sub _class_metaclass_can_be_made_compatible {
     my $self = shift;
     my ($super_meta) = @_;
 
-    my $super_meta_name = $super_meta->_real_ref_name;
-
-    return $self->_can_be_made_compatible_with($super_meta_name);
+    return $self->_can_be_made_compatible_with($super_meta->_real_ref_name);
 }
 
-sub _can_fix_single_metaclass_incompatibility_by_subclassing {
+sub _single_metaclass_can_be_made_compatible {
     my $self = shift;
-    my ($metaclass_type, $super_meta) = @_;
+    my ($super_meta, $metaclass_type) = @_;
 
     my $specific_meta = $self->$metaclass_type;
+
     return unless $super_meta->can($metaclass_type);
     my $super_specific_meta = $super_meta->$metaclass_type;
 
@@ -374,14 +368,14 @@ sub _can_fix_single_metaclass_incompatibility_by_subclassing {
     # this is a really odd case
     return 1 unless defined $specific_meta;
 
-    return $specific_meta->_can_be_made_compatible_with($super_specific_meta);
+    return 1 if $specific_meta->_can_be_made_compatible_with($super_specific_meta);
 }
 
 sub _fix_class_metaclass_incompatibility {
     my $self = shift;
     my ( $super_meta ) = @_;
 
-    if ($self->_can_fix_class_metaclass_incompatibility_by_subclassing($super_meta)) {
+    if ($self->_class_metaclass_can_be_made_compatible($super_meta)) {
         ($self->is_pristine)
             || confess "Can't fix metaclass incompatibility for "
                      . $self->name
@@ -397,7 +391,7 @@ sub _fix_single_metaclass_incompatibility {
     my $self = shift;
     my ( $metaclass_type, $super_meta ) = @_;
 
-    if ($self->_can_fix_single_metaclass_incompatibility_by_subclassing($metaclass_type, $super_meta)) {
+    if ($self->_single_metaclass_can_be_made_compatible($super_meta, $metaclass_type)) {
         ($self->is_pristine)
             || confess "Can't fix metaclass incompatibility for "
                      . $self->name
index c16b1d0..dd02209 100644 (file)
@@ -75,10 +75,9 @@ my @class_mop_class_methods = qw(
     _class_metaclass_is_compatible _single_metaclass_is_compatible
     _fix_metaclass_incompatibility _fix_class_metaclass_incompatibility
     _fix_single_metaclass_incompatibility _base_metaclasses
-    _can_fix_class_metaclass_incompatibility_by_subclassing
-    _can_fix_single_metaclass_incompatibility_by_subclassing
-    _can_fix_metaclass_incompatibility_by_subclassing
     _can_fix_metaclass_incompatibility
+    _class_metaclass_can_be_made_compatible
+    _single_metaclass_can_be_made_compatible
 
     _get_associated_single_metaclass
     _make_metaobject_compatible