From: Jesse Luehrs Date: Thu, 11 Nov 2010 02:43:07 +0000 (-0600) Subject: use new method names from cmop X-Git-Tag: 1.9900~37 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a486d5ade76c569625615022b49d03c92d6e93c2;p=gitmo%2FMoose.git use new method names from cmop --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 882adc6..e59ebaf 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -690,20 +690,20 @@ sub remove_accessors { return; } -sub inline_set { +sub _inline_set_value { my $self = shift; - my ( $instance, $value ) = @_; + my ($instance, $value) = @_; my $mi = $self->associated_class->get_meta_instance; - my $code - = $mi->inline_set_slot_value( $instance, $self->slots, $value ) . ";"; - $code - .= $mi->inline_weaken_slot_value( $instance, $self->slots, $value ) - . " if ref $value;" - if $self->is_weak_ref; + my @code = ($self->SUPER::_inline_set_value(@_)); - return $code; + push @code, ( + $mi->inline_weaken_slot_value($instance, $self->name, $value), + 'if ref ' . $value . ';', + ) if $self->is_weak_ref; + + return @code; } sub install_delegation { diff --git a/lib/Moose/Meta/Method/Accessor.pm b/lib/Moose/Meta/Method/Accessor.pm index 59b5cd4..348c01b 100644 --- a/lib/Moose/Meta/Method/Accessor.pm +++ b/lib/Moose/Meta/Method/Accessor.pm @@ -325,7 +325,7 @@ sub _inline_store_value { my $self = shift; my ($inv, $value) = @_; - return $self->_store_value($inv, $value) . ';'; + return $self->associated_attribute->_inline_set_value($inv, $value); } sub _inline_get_old_value_for_trigger { @@ -360,23 +360,16 @@ sub _inline_return_auto_deref { # expressions -sub _store_value { - my $self = shift; - my ($instance, $value) = @_; - - return $self->associated_attribute->inline_set($instance, $value) . ';'; -} - sub _get_value { my ($self, $instance) = @_; - return $self->associated_attribute->inline_get($instance); + return $self->associated_attribute->_inline_instance_get($instance); } sub _has_value { my ($self, $instance) = @_; - return $self->associated_attribute->inline_has($instance); + return $self->associated_attribute->_inline_instance_has($instance); } sub _auto_deref { diff --git a/lib/Moose/Meta/Method/Accessor/Native.pm b/lib/Moose/Meta/Method/Accessor/Native.pm index e9ccde7..316d5c9 100644 --- a/lib/Moose/Meta/Method/Accessor/Native.pm +++ b/lib/Moose/Meta/Method/Accessor/Native.pm @@ -113,13 +113,13 @@ override _get_value => sub { : $instance . '->$reader'; }; -override _store_value => sub { +override _inline_store_value => sub { my $self = shift; my ($instance, $value) = @_; return $self->_slot_access_can_be_inlined ? super() - : $instance . '->$writer(' . $value . ')'; + : $instance . '->$writer(' . $value . ');'; }; override _eval_environment => sub { diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/clear.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/clear.pm index 1e02731..b4c2ef4 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/clear.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/clear.pm @@ -13,7 +13,7 @@ with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => { -excludes => [ qw( _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ] @@ -25,11 +25,11 @@ sub _adds_members { 0 } sub _potential_value { '[]' } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' = []'; + return $slot_access . ' = [];'; } sub _return_value { '' } diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/delete.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/delete.pm index 58189c3..fc18adf 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/delete.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/delete.pm @@ -15,7 +15,7 @@ with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => { _minimum_arguments _maximum_arguments _inline_check_arguments - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ], @@ -44,11 +44,11 @@ sub _potential_value { . '})'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return '@return = splice @{ (' . $slot_access . ') }, $_[0], 1'; + return '@return = splice @{ (' . $slot_access . ') }, $_[0], 1;'; } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/insert.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/insert.pm index 886344c..1c592bf 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/insert.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/insert.pm @@ -16,7 +16,7 @@ with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => { _maximum_arguments _inline_coerce_new_values _new_members - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ] @@ -53,11 +53,11 @@ sub _inline_coerce_new_values { sub _new_members { '$_[1]' } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return 'splice @{ (' . $slot_access . ') }, $_[0], 0, $_[1]'; + return 'splice @{ (' . $slot_access . ') }, $_[0], 0, $_[1];'; } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/pop.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/pop.pm index 6a91814..994e73c 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/pop.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/pop.pm @@ -13,7 +13,7 @@ with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => { -excludes => [ qw( _maximum_arguments _inline_capture_return_value - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ] }; @@ -38,11 +38,11 @@ sub _inline_capture_return_value { return 'my $old = ' . $slot_access . '->[-1];'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return 'pop @{ (' . $slot_access . ') }'; + return 'pop @{ (' . $slot_access . ') };'; } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/push.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/push.pm index 3d122df..7c5b44c 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/push.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/push.pm @@ -12,7 +12,7 @@ use Moose::Role; with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => { -excludes => [ qw( - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ] @@ -27,11 +27,11 @@ sub _potential_value { return '[ @{ (' . $slot_access . ') }, @_ ]'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return 'push @{ (' . $slot_access . ') }, @_'; + return 'push @{ (' . $slot_access . ') }, @_;'; } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/set.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/set.pm index 4b02f4c..6860f10 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/set.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/set.pm @@ -17,7 +17,7 @@ with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => { _inline_check_arguments _inline_coerce_new_values _new_members - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ] @@ -60,11 +60,11 @@ sub _inline_coerce_new_values { sub _new_members { '$_[1]' } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . '->[$_[0]] = $_[1]'; + return $slot_access . '->[$_[0]] = $_[1];'; } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/shift.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/shift.pm index f1a8fcf..e4a0a72 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/shift.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/shift.pm @@ -14,7 +14,7 @@ with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => { qw( _maximum_arguments _inline_capture_return_value - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ] @@ -40,11 +40,11 @@ sub _inline_capture_return_value { return 'my $old = ' . $slot_access . '->[0];'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return 'shift @{ (' . $slot_access . ') }'; + return 'shift @{ (' . $slot_access . ') };'; } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/splice.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/splice.pm index caccb7f..967a59e 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/splice.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/splice.pm @@ -15,7 +15,7 @@ with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => { _minimum_arguments _inline_process_arguments _inline_check_arguments - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ] @@ -58,13 +58,15 @@ sub _potential_value { . '})'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return '@return = defined $len ' - . '? (splice @{ (' . $slot_access . ') }, $idx, $len, @_) ' - . ': (splice @{ (' . $slot_access . ') }, $idx)'; + return ( + '@return = defined $len', + '? (splice @{ (' . $slot_access . ') }, $idx, $len, @_)', + ': (splice @{ (' . $slot_access . ') }, $idx);', + ); } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/unshift.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/unshift.pm index ce60a44..f545ae2 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/unshift.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/unshift.pm @@ -12,7 +12,7 @@ use Moose::Role; with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => { -excludes => [ qw( - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ] @@ -27,11 +27,11 @@ sub _potential_value { return '[ @_, @{ (' . $slot_access . ') } ]'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return 'unshift @{ (' . $slot_access . ') }, @_'; + return 'unshift @{ (' . $slot_access . ') }, @_;'; } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/Bool/set.pm b/lib/Moose/Meta/Method/Accessor/Native/Bool/set.pm index 03d41a6..9412cfe 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Bool/set.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Bool/set.pm @@ -13,7 +13,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { -excludes => [ qw( _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -22,11 +22,11 @@ sub _maximum_arguments { 0 } sub _potential_value { 1 } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' = 1'; + return $slot_access . ' = 1;'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Bool/toggle.pm b/lib/Moose/Meta/Method/Accessor/Native/Bool/toggle.pm index dcef5cc..2e1b711 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Bool/toggle.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Bool/toggle.pm @@ -13,7 +13,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { -excludes => [ qw( _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -27,11 +27,11 @@ sub _potential_value { return $slot_access . ' ? 0 : 1'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' = ' . $slot_access . ' ? 0 : 1'; + return $slot_access . ' = ' . $slot_access . ' ? 0 : 1;'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Bool/unset.pm b/lib/Moose/Meta/Method/Accessor/Native/Bool/unset.pm index 8b5d0ef..8d8c7b6 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Bool/unset.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Bool/unset.pm @@ -13,7 +13,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { -excludes => [ qw( _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -22,11 +22,11 @@ sub _maximum_arguments { 0 } sub _potential_value { 0 } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' = 0'; + return $slot_access . ' = 0;'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Counter/dec.pm b/lib/Moose/Meta/Method/Accessor/Native/Counter/dec.pm index 2de5bdb..feb38db 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Counter/dec.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Counter/dec.pm @@ -14,7 +14,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { qw( _minimum_arguments _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -29,11 +29,11 @@ sub _potential_value { return $slot_access . ' - (defined $_[0] ? $_[0] : 1)'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' -= defined $_[0] ? $_[0] : 1'; + return $slot_access . ' -= defined $_[0] ? $_[0] : 1;'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Counter/inc.pm b/lib/Moose/Meta/Method/Accessor/Native/Counter/inc.pm index 28add83..a07a24a 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Counter/inc.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Counter/inc.pm @@ -14,7 +14,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { qw( _minimum_arguments _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -29,11 +29,11 @@ sub _potential_value { return $slot_access . ' + (defined $_[0] ? $_[0] : 1)'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' += defined $_[0] ? $_[0] : 1'; + return $slot_access . ' += defined $_[0] ? $_[0] : 1;'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Counter/reset.pm b/lib/Moose/Meta/Method/Accessor/Native/Counter/reset.pm index 39e9954..510f0dd 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Counter/reset.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Counter/reset.pm @@ -13,7 +13,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { -excludes => [ qw( _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -27,11 +27,11 @@ sub _potential_value { return '$attr->default($self)'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' = $attr->default($self)'; + return $slot_access . ' = $attr->default($self);'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Counter/set.pm b/lib/Moose/Meta/Method/Accessor/Native/Counter/set.pm index 3ed83e2..1a32cb3 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Counter/set.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Counter/set.pm @@ -14,7 +14,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { qw( _minimum_arguments _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -24,11 +24,11 @@ sub _maximum_arguments { 1 } sub _potential_value { '$_[0]' } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' = $_[0]'; + return $slot_access . ' = $_[0];'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Hash/clear.pm b/lib/Moose/Meta/Method/Accessor/Native/Hash/clear.pm index debb63b..f2c98c9 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Hash/clear.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Hash/clear.pm @@ -13,7 +13,7 @@ with 'Moose::Meta::Method::Accessor::Native::Hash::Writer' => { -excludes => [ qw( _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ] @@ -25,11 +25,11 @@ sub _adds_members { 0 } sub _potential_value { '{}' } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' = {}'; + return $slot_access . ' = {};'; } sub _return_value { '' } diff --git a/lib/Moose/Meta/Method/Accessor/Native/Hash/delete.pm b/lib/Moose/Meta/Method/Accessor/Native/Hash/delete.pm index f530b41..5961645 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Hash/delete.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Hash/delete.pm @@ -12,7 +12,7 @@ use Moose::Role; with 'Moose::Meta::Method::Accessor::Native::Hash::Writer' => { -excludes => [ qw( - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ], @@ -31,11 +31,11 @@ sub _potential_value { . '})'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return '@return = delete @{ (' . $slot_access . ') }{@_}'; + return '@return = delete @{ (' . $slot_access . ') }{@_};'; } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/Hash/set.pm b/lib/Moose/Meta/Method/Accessor/Native/Hash/set.pm index 720f350..f948d9f 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Hash/set.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Hash/set.pm @@ -20,7 +20,7 @@ with 'Moose::Meta::Method::Accessor::Native::Hash::Writer' => { _inline_process_arguments _inline_check_arguments _inline_coerce_new_values - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ], @@ -97,11 +97,11 @@ sub _potential_value { sub _new_members { '@_[ @values_idx ]' } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return '@{ (' . $slot_access . ') }{ @_[@keys_idx] } = @_[@values_idx]'; + return '@{ (' . $slot_access . ') }{ @_[@keys_idx] } = @_[@values_idx];'; } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/Number/abs.pm b/lib/Moose/Meta/Method/Accessor/Native/Number/abs.pm index d2c2c09..5468cc5 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Number/abs.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Number/abs.pm @@ -13,7 +13,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { -excludes => [ qw( _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -27,11 +27,11 @@ sub _potential_value { return 'abs(' . $slot_access . ')'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' = abs(' . $slot_access . ')'; + return $slot_access . ' = abs(' . $slot_access . ');'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Number/add.pm b/lib/Moose/Meta/Method/Accessor/Native/Number/add.pm index 771cd0d..4db6f81 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Number/add.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Number/add.pm @@ -14,7 +14,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { qw( _minimum_arguments _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -30,11 +30,11 @@ sub _potential_value { return $slot_access . ' + $_[0]'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' += $_[0]'; + return $slot_access . ' += $_[0];'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Number/div.pm b/lib/Moose/Meta/Method/Accessor/Native/Number/div.pm index 1b468c6..2238917 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Number/div.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Number/div.pm @@ -14,7 +14,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { qw( _minimum_arguments _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -30,11 +30,11 @@ sub _potential_value { return $slot_access . ' / $_[0]'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' /= $_[0]'; + return $slot_access . ' /= $_[0];'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Number/mod.pm b/lib/Moose/Meta/Method/Accessor/Native/Number/mod.pm index c665006..e9022f8 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Number/mod.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Number/mod.pm @@ -14,7 +14,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { qw( _minimum_arguments _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -30,11 +30,11 @@ sub _potential_value { return $slot_access . ' % $_[0]'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' %= $_[0]'; + return $slot_access . ' %= $_[0];'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Number/mul.pm b/lib/Moose/Meta/Method/Accessor/Native/Number/mul.pm index ac0f267..643f148 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Number/mul.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Number/mul.pm @@ -14,7 +14,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { qw( _minimum_arguments _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -30,11 +30,11 @@ sub _potential_value { return $slot_access . ' * $_[0]'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' *= $_[0]'; + return $slot_access . ' *= $_[0];'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Number/set.pm b/lib/Moose/Meta/Method/Accessor/Native/Number/set.pm index eddacde..3d8c642 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Number/set.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Number/set.pm @@ -14,7 +14,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { qw( _minimum_arguments _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -24,11 +24,11 @@ sub _maximum_arguments { 1 } sub _potential_value { '$_[0]' } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' = $_[0]'; + return $slot_access . ' = $_[0];'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/Number/sub.pm b/lib/Moose/Meta/Method/Accessor/Native/Number/sub.pm index 380f070..30d5d13 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Number/sub.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Number/sub.pm @@ -14,7 +14,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { qw( _minimum_arguments _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -30,11 +30,11 @@ sub _potential_value { return $slot_access . ' - $_[0]'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' -= $_[0]'; + return $slot_access . ' -= $_[0];'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/String/append.pm b/lib/Moose/Meta/Method/Accessor/Native/String/append.pm index 37ee88b..e20b168 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/String/append.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/String/append.pm @@ -14,7 +14,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { qw( _minimum_arguments _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -30,11 +30,11 @@ sub _potential_value { return '( ' . $slot_access . ' . $_[0] )'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' .= $_[0]'; + return $slot_access . ' .= $_[0];'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/String/chomp.pm b/lib/Moose/Meta/Method/Accessor/Native/String/chomp.pm index 1aa686a..6173952 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/String/chomp.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/String/chomp.pm @@ -13,7 +13,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { -excludes => [ qw( _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ] @@ -32,11 +32,11 @@ sub _potential_value { . '})'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return '@return = chomp ' . $slot_access; + return '@return = chomp ' . $slot_access . ';'; } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/String/chop.pm b/lib/Moose/Meta/Method/Accessor/Native/String/chop.pm index 2f610d5..c2db357 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/String/chop.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/String/chop.pm @@ -13,7 +13,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { -excludes => [ qw( _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ] @@ -32,11 +32,11 @@ sub _potential_value { . '})'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return '@return = chop ' . $slot_access; + return '@return = chop ' . $slot_access . ';'; } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/String/clear.pm b/lib/Moose/Meta/Method/Accessor/Native/String/clear.pm index d881eac..fd7645e 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/String/clear.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/String/clear.pm @@ -13,7 +13,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { -excludes => [ qw( _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -22,11 +22,11 @@ sub _maximum_arguments { 0 } sub _potential_value { '""' } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' = ""'; + return $slot_access . ' = "";'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/String/inc.pm b/lib/Moose/Meta/Method/Accessor/Native/String/inc.pm index 8c4649b..627d243 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/String/inc.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/String/inc.pm @@ -13,7 +13,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { -excludes => [ qw( _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -31,11 +31,11 @@ sub _potential_value { . '})'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . '++'; + return $slot_access . '++;'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/String/prepend.pm b/lib/Moose/Meta/Method/Accessor/Native/String/prepend.pm index 66e3031..15829d3 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/String/prepend.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/String/prepend.pm @@ -14,7 +14,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { qw( _minimum_arguments _maximum_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -30,11 +30,11 @@ sub _potential_value { return '$_[0] . ' . $slot_access; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return $slot_access . ' = $_[0] . ' . $slot_access; + return $slot_access . ' = $_[0] . ' . $slot_access . ';'; } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/String/replace.pm b/lib/Moose/Meta/Method/Accessor/Native/String/replace.pm index ce2bae6..25b0c71 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/String/replace.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/String/replace.pm @@ -18,7 +18,7 @@ with 'Moose::Meta::Method::Accessor::Native::Writer' => { _minimum_arguments _maximum_arguments _inline_check_arguments - _optimized_set_new_value + _inline_optimized_set_new_value ) ] }; @@ -59,15 +59,15 @@ sub _potential_value { . '})'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; - return '(do { ' - . 'ref $_[1] ' - . '? ' . $slot_access . ' =~ s/$_[0]/$_[1]->()/e ' - . ': ' . $slot_access . ' =~ s/$_[0]/$_[1]/; ' - . '})'; + return ( + 'ref $_[1]', + '? ' . $slot_access . ' =~ s/$_[0]/$_[1]->()/e', + ': ' . $slot_access . ' =~ s/$_[0]/$_[1]/;', + ); } no Moose::Role; diff --git a/lib/Moose/Meta/Method/Accessor/Native/String/substr.pm b/lib/Moose/Meta/Method/Accessor/Native/String/substr.pm index 40195e8..37bf3f5 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/String/substr.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/String/substr.pm @@ -30,7 +30,7 @@ with 'Moose::Meta::Method::Accessor::Native::Reader' => { _maximum_arguments _inline_process_arguments _inline_check_arguments - _optimized_set_new_value + _inline_optimized_set_new_value _return_value ) ] @@ -116,12 +116,12 @@ sub _potential_value { . '})'; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; my ($inv, $new, $slot_access) = @_; return '@return = substr ' . $slot_access . ', ' - . '$offset, $length, $replacement'; + . '$offset, $length, $replacement;'; } sub _return_value { diff --git a/lib/Moose/Meta/Method/Accessor/Native/Writer.pm b/lib/Moose/Meta/Method/Accessor/Native/Writer.pm index 9ec8777..b5fc987 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Writer.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Writer.pm @@ -146,20 +146,15 @@ around _inline_check_constraint => sub { sub _inline_capture_return_value { return } -sub _set_new_value { +sub _inline_set_new_value { my $self = shift; - return $self->_store_value(@_) + return $self->_inline_store_value(@_) if $self->_value_needs_copy || !$self->_slot_access_can_be_inlined || !$self->_get_is_lvalue; - return $self->_optimized_set_new_value(@_); -} - -sub _inline_set_new_value { - my $self = shift; - return $self->_set_new_value(@_) . ';'; + return $self->_inline_optimized_set_new_value(@_); } sub _get_is_lvalue { @@ -168,10 +163,10 @@ sub _get_is_lvalue { return $self->associated_attribute->associated_class->instance_metaclass->inline_get_is_lvalue; } -sub _optimized_set_new_value { +sub _inline_optimized_set_new_value { my $self = shift; - return $self->_store_value(@_); + return $self->_inline_store_value(@_); } sub _return_value { diff --git a/lib/Moose/Meta/Method/Constructor.pm b/lib/Moose/Meta/Method/Constructor.pm index 8af110c..718a7bc 100644 --- a/lib/Moose/Meta/Method/Constructor.pm +++ b/lib/Moose/Meta/Method/Constructor.pm @@ -223,7 +223,7 @@ sub _generate_triggers { 'if (exists $params->{\'' . $init_arg . '\'}) {', '$attrs->[' . $i . ']->trigger->(', '$instance,', - $attr->inline_get('$instance') . ',', + $attr->_inline_instance_get('$instance') . ',', ');', '}'; } @@ -327,7 +327,7 @@ sub _generate_slot_assignment { } else { push @source, ( - $attr->inline_set('$instance', $value) . ';', + $attr->_inline_set_value('$instance', $value), ); }