| 1 | package Moose::Meta::Method::Accessor::Native::Array::set; | ||||||||||
| 2 | 7 | our $VERSION = '2.4001'; | |||||||||
| 3 | |||||||||||
| 4 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 7 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 7 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 7 | with 'Moose::Meta::Method::Accessor::Native::Array::Writer'; | |||||||||
| 10 | |||||||||||
| 11 | 31 | ▶ | sub _minimum_arguments { 2 } | ||||||||
|
Subroutine
_minimum_arguments: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 31 | ▶ | sub _maximum_arguments { 2 } | ||||||||
|
Subroutine
_maximum_arguments: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 31 | ▶ | sub _inline_check_arguments { | ||||||||
|
Subroutine
_inline_check_arguments: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 31 | my $self = shift; | |||||||||
| 17 | |||||||||||
| 18 | 31 | return $self->_inline_check_var_is_valid_index('$_[0]'); | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 27 | ▶ | sub _adds_members { 1 } | ||||||||
|
Subroutine
_adds_members: called CC=1 SCAR=0.0
| |||||||||||
| 22 | |||||||||||
| 23 | 61 | ▶ | sub _potential_value { | ||||||||
|
Subroutine
_potential_value: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 61 | my $self = shift; | |||||||||
| 25 | 61 | my ($slot_access) = @_; | |||||||||
| 26 | |||||||||||
| 27 | 61 | return '(do { ' | |||||||||
| 28 | . 'my @potential = @{ (' . $slot_access . ') }; ' | ||||||||||
| 29 | . '$potential[$_[0]] = $_[1]; ' | ||||||||||
| 30 | . '\@potential; ' | ||||||||||
| 31 | . '})'; | ||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | # We need to override this because while @_ can be written to, we cannot write | ||||||||||
| 35 | # directly to $_[1]. | ||||||||||
| 36 | 61 | ▶ | sub _inline_coerce_new_values { | ||||||||
|
Subroutine
_inline_coerce_new_values: called CC=3 SCAR=11.0
| |||||||||||
| 37 | 61 | my $self = shift; | |||||||||
| 38 | |||||||||||
| 39 | 61 | ▶ | return unless $self->associated_attribute->should_coerce; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | |||||||||||
| 41 | 11 | ▶ | return unless $self->_tc_member_type_can_coerce; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | |||||||||||
| 43 | 1 | return '@_ = ($_[0], $member_coercion->($_[1]));'; | |||||||||
| 44 | }; | ||||||||||
| 45 | |||||||||||
| 46 | 27 | ▶ | sub _new_members { '$_[1]' } | ||||||||
|
Subroutine
_new_members: called CC=1 SCAR=0.0
| |||||||||||
| 47 | |||||||||||
| 48 | 38 | ▶ | sub _inline_optimized_set_new_value { | ||||||||
|
Subroutine
_inline_optimized_set_new_value: called CC=1 SCAR=0.0
| |||||||||||
| 49 | 38 | my $self = shift; | |||||||||
| 50 | 38 | my ($inv, $new, $slot_access) = @_; | |||||||||
| 51 | |||||||||||
| 52 | 38 | return $slot_access . '->[$_[0]] = $_[1];'; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 62 | ▶ | sub _return_value { | ||||||||
|
Subroutine
_return_value: called CC=1 SCAR=0.0
| |||||||||||
| 56 | 62 | my $self = shift; | |||||||||
| 57 | 62 | my ($slot_access) = @_; | |||||||||
| 58 | |||||||||||
| 59 | 62 | return $slot_access . '->[$_[0]]'; | |||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 7 | ▶ | no Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 63 | |||||||||||
| 64 | 7 | 1; | |||||||||