From: Dave Rolsky Date: Sun, 26 Sep 2010 05:09:58 +0000 (-0500) Subject: Get inline slot access snippets from attr, not direct from meta-instance X-Git-Tag: 1.15~73 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e06951bb83e29645bd9186e3180a6af480929050;p=gitmo%2FMoose.git Get inline slot access snippets from attr, not direct from meta-instance --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 443b31a..640d1cc 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -577,31 +577,7 @@ sub remove_accessors { return; } -sub inline_get { - my $self = shift; - my ($instance) = @_; - - return $self->associated_class->get_meta_instance->inline_get_slot_value( - $instance, $self->slots ); -} - -sub inline_access { - my $self = shift; - my ($instance) = @_; - - return $self->associated_class->get_meta_instance->inline_slot_access( - $instance, $self->slots ); -} - -sub inline_has { - my $self = shift; - my ($instance) = @_; - - $self->associated_class->get_meta_instance->inline_is_slot_initialized( - $instance, $self->slots ); -} - -sub inline_store { +sub inline_set { my $self = shift; my ( $instance, $value ) = @_; @@ -1003,13 +979,11 @@ methods is almost always an error.) This method overrides the parent to also remove delegation methods. -=item B<< $attr->inline_get >> - -=item B<< $attr->inline_access >> - -=item B<< $attr->inline_has >> +=item B<< $attr->inline_set($instance_var, $value_var) >> -=item B<< $attr->inline_store >> +This method return a code snippet suitable for inlining the relevant +operation. It expect strings containing variable names to be used in the +inlining, like C<'$self'> or C<'$_[1]'>. =item B<< $attr->install_delegation >> diff --git a/lib/Moose/Meta/Method/Accessor.pm b/lib/Moose/Meta/Method/Accessor.pm index 2181e17..14f86b5 100644 --- a/lib/Moose/Meta/Method/Accessor.pm +++ b/lib/Moose/Meta/Method/Accessor.pm @@ -249,7 +249,7 @@ sub _inline_init_slot { sub _inline_store { my ( $self, $instance, $value ) = @_; - return $self->associated_attribute->inline_store( $instance, $value ); + return $self->associated_attribute->inline_set( $instance, $value ); } sub _inline_get_old_value_for_trigger { @@ -277,12 +277,6 @@ sub _inline_get { return $self->associated_attribute->inline_get($instance); } -sub _inline_access { - my ($self, $instance) = @_; - - return $self->associated_attribute->inline_access($instance); -} - sub _inline_has { my ($self, $instance) = @_;