File Coverage

blib/lib/CPU/x86_64/InstructionWriter/Label.pm
Criterion Covered Total %
statement 9 18 50.0
branch 0 12 0.0
condition 0 3 0.0
subroutine 3 7 42.8
pod 3 4 75.0
total 15 44 34.0


line stmt bran cond sub pod time code
1             package CPU::x86_64::InstructionWriter::Label;
2             our $VERSION = '0.002'; # VERSION
3 17     17   114 use strict;
  17         46  
  17         479  
4 17     17   80 use warnings;
  17         71  
  17         360  
5 17     17   87 use Carp;
  17         32  
  17         4573  
6              
7             # ABSTRACT: Object representing a jump target in the code
8              
9              
10 0 0   0 1   sub relative_to { @_ > 1 && carp "Read-only"; $_[0]{relative_to} }
  0            
11 0 0   0 1   sub name { @_ > 1 && carp "Read-only"; $_[0]{name} }
  0            
12 0 0   0 1   sub offset { @_ > 1 && carp "Read-only"; $_[0]{offset} }
  0            
13             sub value {
14 0     0 0   my $offset= $_[0]{offset};
15             my $rel= !defined $_[0]{relative_to}? 0
16             : ref $_[0]{relative_to}? $_[0]{relative_to}->value
17 0 0         : $_[0]{relative_to};
    0          
18 0 0 0       defined $offset && defined $rel? $offset + $rel : undef;
19             }
20              
21              
22             1;
23              
24             __END__