| 1 | package Acme::Lambda::Expr::BinOp; # Abstract Class | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use Acme::Lambda::Expr::Util qw(as_lambda_expr); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 4 | extends qw(Acme::Lambda::Expr::Term); | |||||||||
| 7 | |||||||||||
| 8 | 4 | has lhs => ( | |||||||||
| 9 | is => 'ro', | ||||||||||
| 10 | isa => 'Acme::Lambda::Expr::Term', | ||||||||||
| 11 | |||||||||||
| 12 | coerce => 1, | ||||||||||
| 13 | required => 1, | ||||||||||
| 14 | ); | ||||||||||
| 15 | 4 | has rhs => ( | |||||||||
| 16 | is => 'ro', | ||||||||||
| 17 | isa => 'Acme::Lambda::Expr::Term', | ||||||||||
| 18 | |||||||||||
| 19 | coerce => 1, | ||||||||||
| 20 | required => 1, | ||||||||||
| 21 | ); | ||||||||||
| 22 | |||||||||||
| 23 | sub symbol; # abstract | ||||||||||
| 24 | |||||||||||
| 25 | 72 | ▶ | sub deparse{ | ||||||||
|
Subroutine
deparse: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 26 | 72 | my($self) = @_; | |||||||||
| 27 | 72 | return sprintf '(%s %s %s)', $self->lhs->deparse, $self->symbol, $self->rhs->deparse; | |||||||||
| 28 | } | ||||||||||
| 29 | 0 | ▶ | sub stringify{ | ||||||||
|
Subroutine
stringify: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 30 | 0 | my($self) = @_; | |||||||||
| 31 | 0 | return sprintf '(%s %s %s)', $self->lhs, $self->symbol, $self->rhs; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 50 | ▶ | sub compose{ | ||||||||
|
Subroutine
compose: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 35 | 50 | my($class, $x, $y, $reversed) = @_; | |||||||||
| 36 | |||||||||||
| 37 | 50 | $y = as_lambda_expr($y); | |||||||||
| 38 | |||||||||||
| 39 | 50 | ▶ | ($x, $y) = ($y, $x) if $reversed; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | |||||||||||
| 41 | 50 | return $class->new(lhs => $x, rhs => $y); | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | |||||||||||
| 45 | 4 | __PACKAGE__->meta->make_immutable; | |||||||||
| 46 | |||||||||||