line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moose::Meta::Method::Accessor::Native::Hash::set; |
2
|
|
|
|
|
|
|
our $VERSION = '2.2205'; |
3
|
|
|
|
|
|
|
|
4
|
7
|
|
|
7
|
|
4813
|
use strict; |
|
7
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
236
|
|
5
|
7
|
|
|
7
|
|
41
|
use warnings; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
246
|
|
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
45
|
use List::Util 1.32; |
|
7
|
|
|
|
|
217
|
|
|
7
|
|
|
|
|
476
|
|
8
|
7
|
|
|
7
|
|
46
|
use Moose::Role; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
54
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Moose::Meta::Method::Accessor::Native::Hash::Writer'; |
11
|
|
|
|
|
|
|
|
12
|
20
|
|
|
20
|
|
80
|
sub _minimum_arguments { 2 } |
13
|
|
|
|
|
|
|
|
14
|
20
|
|
|
20
|
|
78
|
sub _maximum_arguments { undef } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
around _inline_check_argument_count => sub { |
17
|
|
|
|
|
|
|
my $orig = shift; |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return ( |
21
|
|
|
|
|
|
|
$self->$orig(@_), |
22
|
|
|
|
|
|
|
'if (@_ % 2) {', |
23
|
|
|
|
|
|
|
$self->_inline_throw_exception( MustPassEvenNumberOfArguments => |
24
|
|
|
|
|
|
|
"method_name => '".$self->delegate_to_method."',". |
25
|
|
|
|
|
|
|
'args => \@_', |
26
|
|
|
|
|
|
|
) . ';', |
27
|
|
|
|
|
|
|
'}', |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _inline_process_arguments { |
32
|
43
|
|
|
43
|
|
80
|
my $self = shift; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
return ( |
35
|
43
|
|
|
|
|
203
|
'my @keys_idx = grep { ! ($_ % 2) } 0..$#_;', |
36
|
|
|
|
|
|
|
'my @values_idx = grep { $_ % 2 } 0..$#_;', |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _inline_check_arguments { |
41
|
43
|
|
|
43
|
|
82
|
my $self = shift; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
return ( |
44
|
43
|
|
|
|
|
134
|
'for (@keys_idx) {', |
45
|
|
|
|
|
|
|
'if (!defined($_[$_])) {', |
46
|
|
|
|
|
|
|
$self->_inline_throw_exception( UndefinedHashKeysPassedToMethod => |
47
|
|
|
|
|
|
|
'hash_keys => \@keys_idx,'. |
48
|
|
|
|
|
|
|
"method_name => '".$self->delegate_to_method."'", |
49
|
|
|
|
|
|
|
) . ';', |
50
|
|
|
|
|
|
|
'}', |
51
|
|
|
|
|
|
|
'}', |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
15
|
|
|
15
|
|
64
|
sub _adds_members { 1 } |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# We need to override this because while @_ can be written to, we cannot write |
58
|
|
|
|
|
|
|
# directly to $_[1]. |
59
|
|
|
|
|
|
|
sub _inline_coerce_new_values { |
60
|
43
|
|
|
43
|
|
91
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
43
|
100
|
|
|
|
143
|
return unless $self->associated_attribute->should_coerce; |
63
|
|
|
|
|
|
|
|
64
|
11
|
100
|
|
|
|
74
|
return unless $self->_tc_member_type_can_coerce; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Is there a simpler way to do this? |
67
|
|
|
|
|
|
|
return ( |
68
|
4
|
|
|
|
|
23
|
'@_ = List::Util::pairmap { $a => $member_coercion->($b) } @_;', |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
}; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _potential_value { |
73
|
43
|
|
|
43
|
|
99
|
my $self = shift; |
74
|
43
|
|
|
|
|
90
|
my ($slot_access) = @_; |
75
|
|
|
|
|
|
|
|
76
|
43
|
|
|
|
|
157
|
return '{ %{ (' . $slot_access . ') }, @_ }'; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
15
|
|
|
15
|
|
50
|
sub _new_members { '@_[ @values_idx ]' } |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub _inline_optimized_set_new_value { |
82
|
26
|
|
|
26
|
|
67
|
my $self = shift; |
83
|
26
|
|
|
|
|
75
|
my ($inv, $new, $slot_access) = @_; |
84
|
|
|
|
|
|
|
|
85
|
26
|
|
|
|
|
163
|
return '@{ (' . $slot_access . ') }{ @_[@keys_idx] } = @_[@values_idx];'; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub _return_value { |
89
|
86
|
|
|
86
|
|
508
|
my $self = shift; |
90
|
86
|
|
|
|
|
180
|
my ($slot_access) = @_; |
91
|
|
|
|
|
|
|
|
92
|
86
|
|
|
|
|
470
|
return 'wantarray ' |
93
|
|
|
|
|
|
|
. '? @{ (' . $slot_access . ') }{ @_[@keys_idx] } ' |
94
|
|
|
|
|
|
|
. ': ' . $slot_access . '->{ $_[$keys_idx[0]] }'; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
7
|
|
|
7
|
|
61
|
no Moose::Role; |
|
7
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
69
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |