line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sidef::Types::Bool::Bool { |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20
|
use 5.014; |
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use overload |
6
|
|
|
|
|
|
|
q{bool} => \&get_value, |
7
|
|
|
|
|
|
|
q{0+} => \&get_value, |
8
|
1
|
0
|
|
1
|
|
1221
|
q{""} => sub { ${$_[0]} ? 'true' : 'false' }; |
|
1
|
|
|
0
|
|
1185
|
|
|
1
|
|
|
|
|
12
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use constant { |
11
|
1
|
|
|
|
|
90
|
TRUE => (bless \(my $t = 1), __PACKAGE__), |
12
|
|
|
|
|
|
|
FALSE => (bless \(my $f = 0), __PACKAGE__), |
13
|
1
|
|
|
1
|
|
142
|
}; |
|
1
|
|
|
|
|
3
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
6
|
use parent qw( |
16
|
|
|
|
|
|
|
Sidef::Object::Object |
17
|
|
|
|
|
|
|
Sidef::Convert::Convert |
18
|
1
|
|
|
1
|
|
386
|
); |
|
1
|
|
|
|
|
346
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
0
|
0
|
|
0
|
1
|
|
$_[1] ? (TRUE) : (FALSE); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
*call = \&new; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
0
|
1
|
|
sub true { (TRUE) } |
27
|
0
|
|
|
0
|
1
|
|
sub false { (FALSE) } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub pick { |
30
|
0
|
0
|
|
0
|
1
|
|
CORE::rand(1) < 0.5 ? (TRUE) : (FALSE); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
*rand = \&pick; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
0
|
|
sub get_value { ${$_[0]} } |
|
0
|
|
|
|
|
|
|
36
|
0
|
|
|
0
|
0
|
|
sub to_bool { $_[0] } |
37
|
|
|
|
|
|
|
*to_b = \&to_bool; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
{ |
40
|
1
|
|
|
1
|
|
248
|
no strict 'refs'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
586
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
*{__PACKAGE__ . '::' . '|'} = sub { |
43
|
0
|
|
|
0
|
|
|
my ($self, $arg) = @_; |
44
|
0
|
0
|
|
|
|
|
$$self ? $self : $arg; |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
*{__PACKAGE__ . '::' . '&'} = sub { |
48
|
0
|
|
|
0
|
|
|
my ($self, $arg) = @_; |
49
|
0
|
0
|
|
|
|
|
$$self ? $arg : $self; |
50
|
|
|
|
|
|
|
}; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
*{__PACKAGE__ . '::' . '^'} = sub { |
53
|
0
|
|
|
0
|
|
|
my ($self, $arg) = @_; |
54
|
0
|
0
|
0
|
|
|
|
($$self xor $arg) ? (TRUE) : (FALSE); |
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
0
|
1
|
|
sub is_true { $_[0] } |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub not { |
61
|
0
|
0
|
|
0
|
0
|
|
${$_[0]} ? (FALSE) : (TRUE); |
|
0
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
*is_false = \¬ |
65
|
|
|
|
|
|
|
*flip = \¬ |
66
|
|
|
|
|
|
|
*toggle = \¬ |
67
|
|
|
|
|
|
|
*neg = \¬ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub dump { |
70
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
71
|
0
|
0
|
|
|
|
|
Sidef::Types::String::String->new($$self ? 'true' : 'false'); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
}; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1 |