From: gfx Date: Sat, 15 Aug 2009 08:28:52 +0000 (+0900) Subject: Accessors are generated only once at add_attribute(), not generated in make_immutable() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bb05d713938d3cbec73716b10ca6b85f3bb44383;p=gitmo%2FClass-MOP.git Accessors are generated only once at add_attribute(), not generated in make_immutable() --- diff --git a/lib/Class/MOP/Attribute.pm b/lib/Class/MOP/Attribute.pm index 27fe3be..e97084c 100644 --- a/lib/Class/MOP/Attribute.pm +++ b/lib/Class/MOP/Attribute.pm @@ -364,7 +364,6 @@ sub _process_accessors { return ($name, $method); } else { - my $inline_me = ($generate_as_inline_methods && $self->associated_class->instance_metaclass->is_inlinable); my $method; eval { if ( $method_ctx ) { @@ -378,7 +377,6 @@ sub _process_accessors { $method = $self->accessor_metaclass->new( attribute => $self, - is_inline => $inline_me, accessor_type => $type, package_name => $self->associated_class->name, name => $accessor, diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 63deff1..a93369c 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -871,7 +871,6 @@ sub _immutable_options { my ( $self, @args ) = @_; return ( - inline_accessors => 1, inline_constructor => 1, inline_destructor => 0, debug => 0, @@ -975,7 +974,6 @@ sub _immutable_metaclass { $immutable_meta->make_immutable( inline_constructor => 0, - inline_accessors => 0, ); return $class_name; @@ -1008,7 +1006,6 @@ sub _install_inlined_code { my ( $self, %args ) = @_; # FIXME - $self->_inline_accessors(%args) if $args{inline_accessors}; $self->_inline_constructor(%args) if $args{inline_constructor}; $self->_inline_destructor(%args) if $args{inline_destructor}; } @@ -1022,6 +1019,8 @@ sub _rebless_as_mutable { } sub _inline_accessors { + Carp::cluck("The _inline_accessors method is deprecated and will be removed in a future release.\n"); + my $self = shift; foreach my $attr_name ( $self->get_attribute_list ) { @@ -1516,8 +1515,6 @@ This method accepts the following options: =over 8 -=item * inline_accessors - =item * inline_constructor =item * inline_destructor diff --git a/lib/Class/MOP/Method/Accessor.pm b/lib/Class/MOP/Method/Accessor.pm index 0cad3b3..45cab21 100644 --- a/lib/Class/MOP/Method/Accessor.pm +++ b/lib/Class/MOP/Method/Accessor.pm @@ -58,7 +58,8 @@ sub _new { original_method => $params->{original_method}, # inherit from Class::MOP::Generated - is_inline => $params->{is_inline} || 0, + is_inline => ($params->{associated_metaclass} + && $params->{associated_metaclass}->instance_metaclass->is_inlinable), definition_context => $params->{definition_context}, # defined in this class