line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dallycot::AST::ComparisonBase; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JSMITH'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: Base class for comparison operations |
5
|
|
|
|
|
|
|
|
6
|
23
|
|
|
23
|
|
8320
|
use strict; |
|
23
|
|
|
|
|
38
|
|
|
23
|
|
|
|
|
676
|
|
7
|
23
|
|
|
23
|
|
90
|
use warnings; |
|
23
|
|
|
|
|
32
|
|
|
23
|
|
|
|
|
480
|
|
8
|
|
|
|
|
|
|
|
9
|
23
|
|
|
23
|
|
94
|
use utf8; |
|
23
|
|
|
|
|
39
|
|
|
23
|
|
|
|
|
117
|
|
10
|
23
|
|
|
23
|
|
472
|
use parent 'Dallycot::AST'; |
|
23
|
|
|
|
|
36
|
|
|
23
|
|
|
|
|
116
|
|
11
|
|
|
|
|
|
|
|
12
|
23
|
|
|
23
|
|
1125
|
use Promises qw(deferred); |
|
23
|
|
|
|
|
46
|
|
|
23
|
|
|
|
|
129
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub execute { |
15
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine ) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $d = deferred; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my @expressions = @$self; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$engine->execute( shift @expressions )->done( |
22
|
|
|
|
|
|
|
sub { |
23
|
0
|
|
|
0
|
|
|
$self->process_loop( $engine, $d, $_[0], @expressions ); |
24
|
|
|
|
|
|
|
}, |
25
|
|
|
|
|
|
|
sub { |
26
|
0
|
|
|
0
|
|
|
$d->reject(@_); |
27
|
|
|
|
|
|
|
} |
28
|
0
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
return $d->promise; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub process_loop { |
34
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine, $d, $left_value, @expressions ) = @_; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if ( !@expressions ) { |
37
|
0
|
|
|
|
|
|
$d->resolve( $engine->TRUE ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
|
|
|
|
|
|
$engine->execute( shift @expressions )->done( |
41
|
|
|
|
|
|
|
sub { |
42
|
0
|
|
|
0
|
|
|
my ($right_value) = @_; |
43
|
|
|
|
|
|
|
$engine->coerce( $left_value, $right_value, [ $left_value->type, $right_value->type ] )->done( |
44
|
|
|
|
|
|
|
sub { |
45
|
0
|
|
|
|
|
|
my ( $cleft, $cright ) = @_; |
46
|
|
|
|
|
|
|
$self->compare( $engine, $cleft, $cright )->done( |
47
|
|
|
|
|
|
|
sub { |
48
|
0
|
0
|
|
|
|
|
if ( $_[0] ) { |
49
|
0
|
|
|
|
|
|
$self->process_loop( $engine, $d, $right_value, @expressions ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
else { |
52
|
0
|
|
|
|
|
|
$d->resolve( $engine->FALSE ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
}, |
55
|
|
|
|
|
|
|
sub { |
56
|
0
|
|
|
|
|
|
$d->reject(@_); |
57
|
|
|
|
|
|
|
} |
58
|
0
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
sub { |
61
|
0
|
|
|
|
|
|
$d->reject(@_); |
62
|
|
|
|
|
|
|
} |
63
|
0
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
}, |
65
|
|
|
|
|
|
|
sub { |
66
|
0
|
|
|
0
|
|
|
$d->reject(@_); |
67
|
|
|
|
|
|
|
} |
68
|
0
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub compare { |
75
|
0
|
|
|
0
|
0
|
|
my ( $engine, $left_value, $right_value ) = @_; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
my $d = deferred; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
$d->reject("Comparison not defined"); |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
return $d->promise; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |