File Coverage

blib/lib/Anarres/Mud/Driver/Program/Variable.pm
Criterion Covered Total %
statement 14 20 70.0
branch 3 6 50.0
condition n/a
subroutine 4 8 50.0
pod 0 5 0.0
total 21 39 53.8


line stmt bran cond sub pod time code
1             package Anarres::Mud::Driver::Program::Variable;
2              
3 4     4   18 use strict;
  4         6  
  4         139  
4 4     4   19 use vars qw(@ISA);
  4         5  
  4         148  
5 4     4   19 use Exporter;
  4         5  
  4         944  
6              
7             @ISA = qw(Exporter);
8              
9             # Stuff gets put into Export from Compiler.xs
10              
11             # New representation will be [ Type, Flags, Name, Args, Code ]
12             # Args and Code are only relevant for Method objects.
13              
14             sub new {
15 276     276 0 308 my $class = shift;
16 276 50       966 my $self = ($#_ == 0) ? { %{ (shift) } } : { @_ };
  0         0  
17             # Avoid some 'undefined value' warnings late.
18 276 50       685 $self->{Flags} = 0 unless exists $self->{Flags};
19 276 50       485 die "No type when creating $class\n" unless $self->{Type};
20 276         953 return bless $self, $class;
21             }
22              
23 0     0 0   sub name { return $_[0]->{Name}; }
24 0     0 0   sub type { return $_[0]->{Type}; }
25 0     0 0   sub flags { return $_[0]->{Flags}; }
26              
27             sub dump {
28 0     0 0   my $self = shift;
29 0           return "([" . $self->type->dump(@_) . "] var " . $self->name . ")";
30             }
31              
32             1;