| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::RecordStream::DomainLanguage::Executor; |
|
2
|
|
|
|
|
|
|
|
|
3
|
27
|
|
|
27
|
|
165
|
use strict; |
|
|
27
|
|
|
|
|
57
|
|
|
|
27
|
|
|
|
|
731
|
|
|
4
|
27
|
|
|
27
|
|
143
|
use warnings; |
|
|
27
|
|
|
|
|
59
|
|
|
|
27
|
|
|
|
|
669
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
27
|
|
|
27
|
|
161
|
use App::RecordStream::DomainLanguage::Registry; |
|
|
27
|
|
|
|
|
60
|
|
|
|
27
|
|
|
|
|
649
|
|
|
7
|
27
|
|
|
27
|
|
6024
|
use App::RecordStream::Executor; |
|
|
27
|
|
|
|
|
81
|
|
|
|
27
|
|
|
|
|
2414
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $next_id = 0; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new |
|
12
|
|
|
|
|
|
|
{ |
|
13
|
389
|
|
|
389
|
0
|
818
|
my $class = shift; |
|
14
|
|
|
|
|
|
|
|
|
15
|
389
|
|
|
|
|
746
|
my $id = $next_id++; |
|
16
|
|
|
|
|
|
|
|
|
17
|
389
|
|
|
|
|
948
|
my $this = |
|
18
|
|
|
|
|
|
|
{ |
|
19
|
|
|
|
|
|
|
'ID' => $id, |
|
20
|
|
|
|
|
|
|
}; |
|
21
|
|
|
|
|
|
|
|
|
22
|
389
|
|
|
|
|
821
|
bless $this, $class; |
|
23
|
|
|
|
|
|
|
|
|
24
|
389
|
|
|
|
|
992
|
return $this; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub clear_vars |
|
28
|
|
|
|
|
|
|
{ |
|
29
|
0
|
|
|
0
|
0
|
0
|
my $this = shift; |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
0
|
my $id = $this->{'ID'}; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
{ |
|
34
|
27
|
|
|
27
|
|
174
|
no strict; |
|
|
27
|
|
|
|
|
94
|
|
|
|
27
|
|
|
|
|
652
|
|
|
|
0
|
|
|
|
|
0
|
|
|
35
|
27
|
|
|
27
|
|
168
|
no warnings; |
|
|
27
|
|
|
|
|
61
|
|
|
|
27
|
|
|
|
|
2377
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
0
|
%{__PACKAGE__ . "::Sandbox" . $id . "::"} = (); |
|
|
0
|
|
|
|
|
0
|
|
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub set_scalar |
|
42
|
|
|
|
|
|
|
{ |
|
43
|
302
|
|
|
302
|
0
|
842
|
my $this = shift; |
|
44
|
302
|
|
|
|
|
847
|
my $var = shift; |
|
45
|
302
|
|
|
|
|
733
|
my $val = shift; |
|
46
|
|
|
|
|
|
|
|
|
47
|
302
|
|
|
|
|
536
|
my $id = $this->{'ID'}; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
{ |
|
50
|
27
|
|
|
27
|
|
166
|
no strict; |
|
|
27
|
|
|
|
|
63
|
|
|
|
27
|
|
|
|
|
583
|
|
|
|
302
|
|
|
|
|
462
|
|
|
51
|
27
|
|
|
27
|
|
135
|
no warnings; |
|
|
27
|
|
|
|
|
68
|
|
|
|
27
|
|
|
|
|
2103
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
302
|
|
|
|
|
857
|
*{__PACKAGE__ . "::Sandbox" . $id . "::" . $var} = \$val; |
|
|
302
|
|
|
|
|
1952
|
|
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub get_scalar |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
0
|
|
|
0
|
0
|
0
|
my $this = shift; |
|
60
|
0
|
|
|
|
|
0
|
my $var = shift; |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
0
|
my $id = $this->{'ID'}; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
{ |
|
65
|
27
|
|
|
27
|
|
170
|
no strict; |
|
|
27
|
|
|
|
|
62
|
|
|
|
27
|
|
|
|
|
589
|
|
|
|
0
|
|
|
|
|
0
|
|
|
66
|
27
|
|
|
27
|
|
136
|
no warnings; |
|
|
27
|
|
|
|
|
66
|
|
|
|
27
|
|
|
|
|
2516
|
|
|
67
|
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
0
|
return ${__PACKAGE__ . "::Sandbox" . $id . "::" . $var}; |
|
|
0
|
|
|
|
|
0
|
|
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub set_ref |
|
73
|
|
|
|
|
|
|
{ |
|
74
|
59320
|
|
|
59320
|
0
|
85361
|
my $this = shift; |
|
75
|
59320
|
|
|
|
|
81524
|
my $var = shift; |
|
76
|
59320
|
|
|
|
|
77911
|
my $ref = shift; |
|
77
|
|
|
|
|
|
|
|
|
78
|
59320
|
|
|
|
|
87010
|
my $id = $this->{'ID'}; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
{ |
|
81
|
27
|
|
|
27
|
|
165
|
no strict; |
|
|
27
|
|
|
|
|
65
|
|
|
|
27
|
|
|
|
|
614
|
|
|
|
59320
|
|
|
|
|
78885
|
|
|
82
|
27
|
|
|
27
|
|
139
|
no warnings; |
|
|
27
|
|
|
|
|
60
|
|
|
|
27
|
|
|
|
|
6536
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
59320
|
|
|
|
|
76966
|
*{__PACKAGE__ . "::Sandbox" . $id . "::" . $var} = $ref; |
|
|
59320
|
|
|
|
|
284871
|
|
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# TODO: amling, default this? |
|
89
|
|
|
|
|
|
|
sub import_registry |
|
90
|
|
|
|
|
|
|
{ |
|
91
|
389
|
|
|
389
|
0
|
666
|
my $this = shift; |
|
92
|
|
|
|
|
|
|
|
|
93
|
389
|
|
|
|
|
1167
|
for my $token (App::RecordStream::DomainLanguage::Registry::get_tokens()) |
|
94
|
|
|
|
|
|
|
{ |
|
95
|
|
|
|
|
|
|
my $subref = sub |
|
96
|
|
|
|
|
|
|
{ |
|
97
|
343
|
|
|
343
|
|
1204
|
my $value = App::RecordStream::DomainLanguage::Registry::evaluate($token, @_); |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# this is somewhat terrible... |
|
100
|
343
|
|
|
|
|
1011
|
my @pp = $value->get_possible_pairs(); |
|
101
|
343
|
50
|
66
|
|
|
1000
|
if(!@_ && !@pp) |
|
102
|
|
|
|
|
|
|
{ |
|
103
|
|
|
|
|
|
|
# The idea is this... if they use a field name that doesn't |
|
104
|
|
|
|
|
|
|
# conflict with a nullary function then we pretend it was a |
|
105
|
|
|
|
|
|
|
# barewords scalar. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# Unfortunately this means e.g. "rec" is indistinguishable |
|
108
|
|
|
|
|
|
|
# between the valuation that returns the "rec" field and the |
|
109
|
|
|
|
|
|
|
# valuation that returns the current record. We allow the |
|
110
|
|
|
|
|
|
|
# "rec" field possibility via the explicit "valuation" ctor. |
|
111
|
0
|
|
|
|
|
0
|
$value->add_possibility('SCALAR', $token); |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
343
|
|
|
|
|
2368
|
return $value; |
|
115
|
29642
|
|
|
|
|
111666
|
}; |
|
116
|
29642
|
|
|
|
|
78339
|
$this->set_ref($token, $subref); |
|
117
|
29642
|
|
|
|
|
76844
|
$this->set_ref("_$token", $subref); # for e.g. "last" which is reserved |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub exec |
|
122
|
|
|
|
|
|
|
{ |
|
123
|
389
|
|
|
389
|
0
|
719
|
my $__MY__this = shift; |
|
124
|
389
|
|
|
|
|
800
|
my $__MY__code = shift; |
|
125
|
|
|
|
|
|
|
|
|
126
|
389
|
|
|
|
|
1487
|
$__MY__code = App::RecordStream::Executor->transform_code($__MY__code); |
|
127
|
|
|
|
|
|
|
|
|
128
|
389
|
|
|
|
|
795
|
my $__MY__id = $__MY__this->{'ID'}; |
|
129
|
|
|
|
|
|
|
|
|
130
|
389
|
|
|
|
|
1155
|
my $__MY__code_packaged = "package " . __PACKAGE__ . "::Sandbox$__MY__id; $__MY__code"; |
|
131
|
389
|
|
|
|
|
826
|
my $__MY__ret; |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
{ |
|
134
|
27
|
|
|
27
|
|
177
|
no strict; |
|
|
27
|
|
|
|
|
63
|
|
|
|
27
|
|
|
|
|
574
|
|
|
|
389
|
|
|
|
|
648
|
|
|
135
|
27
|
|
|
27
|
|
135
|
no warnings; |
|
|
27
|
|
|
|
|
65
|
|
|
|
27
|
|
|
|
|
1904
|
|
|
136
|
|
|
|
|
|
|
|
|
137
|
389
|
|
|
|
|
36882
|
$__MY__ret = eval $__MY__code_packaged; |
|
138
|
|
|
|
|
|
|
|
|
139
|
389
|
50
|
|
|
|
2030
|
if($@) |
|
140
|
|
|
|
|
|
|
{ |
|
141
|
0
|
|
|
|
|
0
|
die $@; |
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
|
|
145
|
389
|
|
|
|
|
1215
|
return $__MY__ret; |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
1; |