Get inline slot access snippets from attr, not direct from meta-instance
[gitmo/Moose.git] / lib / Moose / Meta / Class.pm
index 4f2a829..2951ead 100644 (file)
@@ -12,7 +12,7 @@ use List::Util qw( first );
 use List::MoreUtils qw( any all uniq first_index );
 use Scalar::Util 'weaken', 'blessed';
 
-our $VERSION   = '1.07';
+our $VERSION   = '1.14';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -69,19 +69,6 @@ sub initialize {
             );
 }
 
-sub _immutable_options {
-    my ( $self, @args ) = @_;
-
-    $self->SUPER::_immutable_options(
-        inline_destructor => 1,
-
-        # Moose always does this when an attribute is created
-        inline_accessors => 0,
-
-        @args,
-    );
-}
-
 sub create {
     my ($class, $package_name, %options) = @_;
 
@@ -407,7 +394,7 @@ sub _is_role_only_subclass {
 
     # loop over all methods that are a part of the current class
     # (not inherited)
-    for my $method (map { $meta->get_method($_) } $meta->get_method_list) {
+    for my $method ( $meta->_get_local_methods ) {
         # always ignore meta
         next if $method->name eq 'meta';
         # we'll deal with attributes below
@@ -525,6 +512,14 @@ sub _reconcile_roles_for_metaclass {
     my @role_differences = $self->_role_differences(
         $class_meta_name, $super_meta_name,
     );
+
+    # handle the case where we need to fix compatibility between a class and
+    # its parent, but all roles in the class are already also done by the
+    # parent
+    # see t/050/054.t
+    return Class::MOP::class_of($super_meta_name)
+        unless @role_differences;
+
     return Moose::Meta::Class->create_anon_class(
         superclasses => [$super_meta_name],
         roles        => \@role_differences,
@@ -645,6 +640,21 @@ sub _process_inherited_attribute {
     }
 }
 
+## Immutability
+
+sub _immutable_options {
+    my ( $self, @args ) = @_;
+
+    $self->SUPER::_immutable_options(
+        inline_destructor => 1,
+
+        # Moose always does this when an attribute is created
+        inline_accessors => 0,
+
+        @args,
+    );
+}
+
 ## -------------------------------------------------
 
 our $error_level;
@@ -760,8 +770,8 @@ This overrides the parent's method to add a few options. Specifically,
 it uses the Moose-specific constructor and destructor classes, and
 enables inlining the destructor.
 
-Also, since Moose always inlines attributes, it sets the
-C<inline_accessors> option to false.
+Since Moose always inlines attributes, it sets the C<inline_accessors> option
+to false.
 
 =item B<< $metaclass->new_object(%params) >>
 
@@ -832,8 +842,8 @@ be provided as a hash reference.
 
 =item B<< $metaclass->destructor_class($class_name) >>
 
-These are the names of classes used when making a class
-immutable. These default to L<Moose::Meta::Method::Constructor> and
+These are the names of classes used when making a class immutable. These
+default to L<Moose::Meta::Method::Constructor> and
 L<Moose::Meta::Method::Destructor> respectively. These accessors are
 read-write, so you can use them to change the class name.