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=67b86abc80d8acdb22219d2ae90d0a15ebf8d3e2;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 8f30cc2..40bcf28 100644 --- a/lib/Class/MOP/Attribute.pm +++ b/lib/Class/MOP/Attribute.pm @@ -370,7 +370,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 ) { @@ -384,7 +383,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 0f80950..9ffcda3 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -940,7 +940,6 @@ sub _immutable_options { my ( $self, @args ) = @_; return ( - inline_accessors => 1, inline_constructor => 1, inline_destructor => 0, debug => 0, @@ -1044,7 +1043,6 @@ sub _immutable_metaclass { $immutable_meta->make_immutable( inline_constructor => 0, - inline_accessors => 0, ); return $class_name; @@ -1077,7 +1075,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}; } @@ -1091,6 +1088,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 ) { @@ -1585,8 +1584,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 a92b5bc..395fd59 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