line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include "EXTERN.h" |
2
|
|
|
|
|
|
|
#include "perl.h" |
3
|
|
|
|
|
|
|
#include "XSUB.h" |
4
|
|
|
|
|
|
|
#include "hook_op_check.h" |
5
|
|
|
|
|
|
|
#include "ppport.h" |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
STATIC OP *last_list_start; |
8
|
|
|
|
|
|
|
|
9
|
342
|
|
|
|
|
|
STATIC OP *multidimensional_list_check_op (pTHX_ OP *op, void *user_data) { |
10
|
|
|
|
|
|
|
PERL_UNUSED_ARG(user_data); |
11
|
|
|
|
|
|
|
|
12
|
342
|
100
|
|
|
|
|
last_list_start = OpSIBLING(((LISTOP*)op)->op_first); |
13
|
|
|
|
|
|
|
|
14
|
342
|
|
|
|
|
|
return op; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
55
|
|
|
|
|
|
STATIC OP *multidimensional_helem_check_op (pTHX_ OP *op, void *user_data) { |
18
|
55
|
|
|
|
|
|
SV **hint = hv_fetchs(GvHV(PL_hintgv), "multidimensional/disabled", 0); |
19
|
|
|
|
|
|
|
const OP *last; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
PERL_UNUSED_ARG(user_data); |
22
|
|
|
|
|
|
|
|
23
|
55
|
100
|
|
|
|
|
if (!hint || !SvOK(*hint)) |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
24
|
46
|
|
|
|
|
|
return op; |
25
|
|
|
|
|
|
|
|
26
|
9
|
50
|
|
|
|
|
last = OpSIBLING(((BINOP*)op)->op_first); |
27
|
9
|
50
|
|
|
|
|
if (last && last->op_type == OP_JOIN) { |
|
|
50
|
|
|
|
|
|
28
|
9
|
|
|
|
|
|
const OP *first = ((LISTOP*)last)->op_first; |
29
|
9
|
50
|
|
|
|
|
const OP *next = OpSIBLING(first); |
30
|
9
|
50
|
|
|
|
|
if (first && first->op_type == OP_PUSHMARK |
|
|
50
|
|
|
|
|
|
31
|
9
|
50
|
|
|
|
|
&& next && next->op_type == OP_RV2SV |
|
|
100
|
|
|
|
|
|
32
|
7
|
100
|
|
|
|
|
&& next != last_list_start |
33
|
|
|
|
|
|
|
) { |
34
|
6
|
|
|
|
|
|
const OP *child = ((UNOP*)next)->op_first; |
35
|
6
|
50
|
|
|
|
|
if (child->op_type == OP_GV |
36
|
6
|
50
|
|
|
|
|
&& GvSV(cGVOPx_gv(child)) == get_sv(";", 0) |
37
|
|
|
|
|
|
|
) { |
38
|
6
|
|
|
|
|
|
croak("Use of multidimensional array emulation"); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
3
|
|
|
|
|
|
return op; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
MODULE = multidimensional PACKAGE = multidimensional |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
PROTOTYPES: ENABLE |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
BOOT: |
50
|
1
|
|
|
|
|
|
hook_op_check(OP_HELEM, multidimensional_helem_check_op, NULL); |
51
|
1
|
|
|
|
|
|
hook_op_check(OP_LIST, multidimensional_list_check_op, NULL); |