line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::TypeCheck::Pad2type; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1309
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
6
|
use Devel::TypeCheck::Type; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
8
|
use Devel::TypeCheck::Sym2type; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
5
|
use Devel::TypeCheck::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
74
|
|
7
|
1
|
|
|
1
|
|
6
|
use B; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
8
|
1
|
|
|
1
|
|
1075
|
use IO::Handle; |
|
1
|
|
|
|
|
8949
|
|
|
1
|
|
|
|
|
496
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Devel::TypeCheck::Pad2type - Symbol table for pads. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Pad2type maintains a symbol table for pads, which are the lexically |
17
|
|
|
|
|
|
|
scoped symbols are referenced. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=over 4 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
our @ISA = qw(Devel::TypeCheck::Sym2type); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
27
|
0
|
|
|
0
|
1
|
|
my ($name) = @_; |
28
|
0
|
|
|
|
|
|
return bless([], $name); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub get { |
32
|
0
|
|
|
0
|
1
|
|
my ($this, $pad, $env) = @_; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if (!exists($this->[$pad])) { |
35
|
0
|
|
|
|
|
|
$this->[$pad] = $env->fresh(); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $this->[$pad]; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item B($fh, $cv, $env) |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Print out this pad to the given file handle using the given CV and |
44
|
|
|
|
|
|
|
type environment. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
sub print { |
48
|
0
|
|
|
0
|
1
|
|
my ($this, $fh, $cv, $env) = @_; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my ($i, $t); |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
$fh->print(" Pad Table Types:\n Name Type\n ----------------------------------------\n"); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
format P2T = |
55
|
|
|
|
|
|
|
@<<<<<<<<<<<<<<<<<< @* |
56
|
|
|
|
|
|
|
$i, $t |
57
|
|
|
|
|
|
|
. |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my %set; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
for my $j (0 .. $#$this) { |
62
|
0
|
0
|
|
|
|
|
next unless defined($this->[$j]); |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $sv = (($cv->PADLIST()->ARRAY())[0]->ARRAY)[$j]; |
65
|
0
|
|
|
|
|
|
$i = $sv->PVX; |
66
|
0
|
|
|
|
|
|
my $intro = $sv->NVX; |
67
|
0
|
|
|
|
|
|
my $finish = int($sv->IVX); |
68
|
0
|
|
|
|
|
|
$i .= ":$intro,$finish"; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
$t = $this->[$j]->str($env); |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$fh->format_write("Devel::TypeCheck::Pad2type::P2T"); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
$fh->print("\n"); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=back |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 AUTHOR |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Gary Jackson, C<< >> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 BUGS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This version is specific to Perl 5.8.1. It may work with other |
89
|
|
|
|
|
|
|
versions that have the same opcode list and structure, but this is |
90
|
|
|
|
|
|
|
entirely untested. It definitely will not work if those parameters |
91
|
|
|
|
|
|
|
change. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
94
|
|
|
|
|
|
|
C, or through the web interface at |
95
|
|
|
|
|
|
|
L. |
96
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
97
|
|
|
|
|
|
|
your bug as I make changes. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Copyright 2005 Gary Jackson, all rights reserved. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
104
|
|
|
|
|
|
|
under the same terms as Perl itself. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |