line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MouseX::NativeTraits::MethodProvider::Num; |
2
|
2
|
|
|
2
|
|
1504
|
use Mouse; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
14
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
extends qw(MouseX::NativeTraits::MethodProvider); |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub generate_add { |
7
|
10
|
|
|
10
|
1
|
313
|
my($self) = @_; |
8
|
10
|
|
|
|
|
25
|
my $reader = $self->reader; |
9
|
10
|
|
|
|
|
21
|
my $writer = $self->writer; |
10
|
10
|
|
|
|
|
28
|
my $constraint = $self->attr->type_constraint; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
return sub { |
13
|
32
|
|
|
32
|
|
38738
|
my($instance, $value) = @_; |
|
|
|
|
104
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
52
|
|
|
|
14
|
32
|
100
|
|
|
|
112
|
if(@_ != 2) { |
15
|
10
|
|
|
|
|
61
|
$self->argument_error('add', 2, 2, scalar @_); |
16
|
|
|
|
|
|
|
} |
17
|
22
|
|
|
|
|
95
|
$constraint->assert_valid($value); |
18
|
22
|
|
|
|
|
284
|
$writer->( $instance, $reader->( $instance ) + $value ); |
19
|
10
|
|
|
|
|
68
|
}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub generate_sub { |
23
|
10
|
|
|
10
|
1
|
153
|
my($self) = @_; |
24
|
10
|
|
|
|
|
33
|
my $reader = $self->reader; |
25
|
10
|
|
|
|
|
87
|
my $writer = $self->writer; |
26
|
10
|
|
|
|
|
135
|
my $constraint = $self->attr->type_constraint; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return sub { |
29
|
30
|
|
|
30
|
|
14528
|
my($instance, $value) = @_; |
30
|
30
|
100
|
|
|
|
104
|
if(@_ != 2) { |
31
|
10
|
|
|
|
|
46
|
$self->argument_error('sub', 2, 2, scalar @_); |
32
|
|
|
|
|
|
|
} |
33
|
20
|
|
|
|
|
75
|
$constraint->assert_valid($value); |
34
|
20
|
|
|
|
|
262
|
$writer->( $instance, $reader->( $instance ) - $value ); |
35
|
10
|
|
|
|
|
72
|
}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub generate_mul { |
39
|
5
|
|
|
35
|
1
|
99
|
my($self) = @_; |
40
|
5
|
|
|
|
|
25
|
my $reader = $self->reader; |
41
|
5
|
|
|
|
|
90
|
my $writer = $self->writer; |
42
|
5
|
|
|
|
|
70
|
my $constraint = $self->attr->type_constraint; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
return sub { |
45
|
20
|
|
|
50
|
|
13089
|
my($instance, $value) = @_; |
46
|
20
|
100
|
|
|
|
67
|
if(@_ != 2) { |
47
|
10
|
|
|
|
|
90
|
$self->argument_error('mul', 2, 2, scalar @_); |
48
|
|
|
|
|
|
|
} |
49
|
10
|
|
|
|
|
114
|
$constraint->assert_valid($value); |
50
|
10
|
|
|
|
|
157
|
$writer->( $instance, $reader->( $instance ) * $value ); |
51
|
5
|
|
|
|
|
33
|
}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub generate_div { |
55
|
10
|
|
|
60
|
1
|
152
|
my($self) = @_; |
56
|
10
|
|
|
|
|
197
|
my $reader = $self->reader; |
57
|
10
|
|
|
|
|
56
|
my $writer = $self->writer; |
58
|
10
|
|
|
|
|
52
|
my $constraint = $self->attr->type_constraint; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
return sub { |
61
|
20
|
|
|
70
|
|
33467
|
my($instance, $value) = @_; |
62
|
20
|
100
|
|
|
|
70
|
if(@_ != 2) { |
63
|
10
|
|
|
|
|
59
|
$self->argument_error('div', 2, 2, scalar @_); |
64
|
|
|
|
|
|
|
} |
65
|
10
|
|
|
|
|
49
|
$constraint->assert_valid($value); |
66
|
10
|
|
|
|
|
150
|
$writer->( $instance, $reader->( $instance ) / $value ); |
67
|
10
|
|
|
|
|
76
|
}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub generate_mod { |
71
|
10
|
|
|
80
|
1
|
147
|
my($self) = @_; |
72
|
10
|
|
|
|
|
23
|
my $reader = $self->reader; |
73
|
10
|
|
|
|
|
21
|
my $writer = $self->writer; |
74
|
10
|
|
|
|
|
30
|
my $constraint = $self->attr->type_constraint; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
return sub { |
77
|
32
|
|
|
72
|
|
27311
|
my($instance, $value) = @_; |
78
|
32
|
100
|
|
|
|
115
|
if(@_ != 2) { |
79
|
10
|
|
|
|
|
49
|
$self->argument_error('mod', 2, 2, scalar @_); |
80
|
|
|
|
|
|
|
} |
81
|
22
|
|
|
|
|
90
|
$constraint->assert_valid($value); |
82
|
22
|
|
|
|
|
288
|
$writer->( $instance, $reader->( $instance ) % $value ); |
83
|
10
|
|
|
|
|
65
|
}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub generate_abs { |
88
|
5
|
|
|
77
|
1
|
80
|
my($self) = @_; |
89
|
5
|
|
|
|
|
14
|
my $reader = $self->reader; |
90
|
5
|
|
|
|
|
12
|
my $writer = $self->writer; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
return sub { |
93
|
20
|
|
|
72
|
|
6242
|
my($instance) = @_; |
94
|
20
|
100
|
|
|
|
85
|
if(@_ != 1) { |
95
|
10
|
|
|
|
|
48
|
$self->argument_error('abs', 1, 1, scalar @_); |
96
|
|
|
|
|
|
|
} |
97
|
10
|
|
|
|
|
64
|
$writer->( $instance, abs( $reader->( $instance ) ) ); |
98
|
5
|
|
|
|
|
41
|
}; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
2
|
|
|
2
|
|
2495
|
no Mouse; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
16
|
|
102
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |