line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
21
|
|
|
21
|
|
135
|
use strict; |
|
21
|
|
|
|
|
40
|
|
|
21
|
|
|
|
|
797
|
|
3
|
21
|
|
|
21
|
|
106
|
use warnings; |
|
21
|
|
|
|
|
45
|
|
|
21
|
|
|
|
|
736
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package WWW::Shopify::Liquid::Operator; |
6
|
21
|
|
|
21
|
|
99
|
use base 'WWW::Shopify::Liquid::Element'; |
|
21
|
|
|
|
|
35
|
|
|
21
|
|
|
|
|
14342
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
118
|
|
|
118
|
0
|
187
|
my $package = shift; |
9
|
118
|
|
|
|
|
609
|
my $self = bless { core => shift, operands => undef }, $package; |
10
|
118
|
50
|
|
|
|
742
|
$self->{operands} = [@_] if int(@_) >= 1; |
11
|
118
|
|
|
|
|
979
|
return $self; |
12
|
|
|
|
|
|
|
} |
13
|
0
|
|
|
0
|
0
|
0
|
sub operands { my $self = shift; $self->{operands} = [@_]; return $self->{operands}; } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
0
|
0
|
0
|
sub tokens { return map { $_->tokens } (@{$_[0]->{operands}}) } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub process { |
18
|
36
|
|
|
36
|
0
|
44
|
my ($self, $hash, $action) = @_; |
19
|
36
|
|
|
|
|
83
|
my ($op1, $op2) = ($self->{operands}->[0], $self->{operands}->[1]); |
20
|
36
|
50
|
|
|
|
105
|
$op1 = $op1->$action($hash) unless $self->is_processed($op1); |
21
|
36
|
50
|
|
|
|
87
|
$op2 = $op2->$action($hash) unless $self->is_processed($op2); |
22
|
36
|
50
|
33
|
|
|
92
|
if ((!$self->is_processed($op1) || !$self->is_processed($op2)) && $action eq "optimize") { |
|
|
|
33
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
$self->{operands} = [$op1, $op2]; |
24
|
0
|
|
|
|
|
0
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
36
|
|
|
|
|
108
|
return $self->operate($hash, $action, $op1, $op2); |
27
|
|
|
|
|
|
|
} |
28
|
230
|
|
|
230
|
0
|
355
|
sub priority { return 0; } |
29
|
|
|
|
|
|
|
# If we require a grouping, it means that it must be wrapped in parentheses, due to how Shopify works. Only relevant for reconversion. |
30
|
1
|
|
|
1
|
0
|
4
|
sub requires_grouping { return 0; } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |