line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::TypeCheck::Type::Nu; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
7
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Devel::TypeCheck::Type; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
7
|
1
|
|
|
1
|
|
7
|
use Devel::TypeCheck::Type::TSub; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
71
|
|
8
|
1
|
|
|
1
|
|
7
|
use Devel::TypeCheck::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
206
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Devel::TypeCheck::Type::Nu - Type representing Number values. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Devel::TypeCheck::Type::Nu; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Nu represents number values. The underlying subtype can be an IV |
21
|
|
|
|
|
|
|
(integer) or DV (double float), or a variable to represent ambiguity. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Inherits from Devel::TypeCheck::Type::TSub and Devel::TypeCheck::Type::TVar. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
our @ISA = qw(Devel::TypeCheck::Type::TSub Devel::TypeCheck::Type::TVar); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# **** CLASS **** |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our @SUBTYPES; |
31
|
|
|
|
|
|
|
our @subtypes; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
BEGIN { |
34
|
1
|
|
|
1
|
|
7
|
@SUBTYPES = (Devel::TypeCheck::Type::IV(), Devel::TypeCheck::Type::DV(), Devel::TypeCheck::Type::VAR()); |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
3
|
for my $i (@SUBTYPES) { |
37
|
3
|
|
|
|
|
160
|
$subtypes[$i] = 1; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub hasSubtype { |
42
|
0
|
|
|
0
|
1
|
|
my ($this, $index) = @_; |
43
|
0
|
|
|
|
|
|
return ($subtypes[$index]); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub type { |
47
|
0
|
|
|
0
|
1
|
|
return Devel::TypeCheck::Type::N(); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub pretty { |
51
|
0
|
|
|
0
|
1
|
|
my ($this, $env) = @_; |
52
|
0
|
|
|
|
|
|
return "NUMBER of " . $this->subtype->pretty($env); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
TRUE; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 AUTHOR |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Gary Jackson, C<< >> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 BUGS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This version is specific to Perl 5.8.1. It may work with other |
64
|
|
|
|
|
|
|
versions that have the same opcode list and structure, but this is |
65
|
|
|
|
|
|
|
entirely untested. It definitely will not work if those parameters |
66
|
|
|
|
|
|
|
change. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
69
|
|
|
|
|
|
|
C, or through the web interface at |
70
|
|
|
|
|
|
|
L. |
71
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
72
|
|
|
|
|
|
|
your bug as I make changes. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Copyright 2005 Gary Jackson, all rights reserved. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
79
|
|
|
|
|
|
|
under the same terms as Perl itself. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |