summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/parser_helper.ml
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-04-30 09:30:59 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-04-30 09:30:59 +0000
commitd6ed071ca23941755671614ad566d3524d044f8b (patch)
tree8db07600d47e964fe82ef0ef4613017493df9550 /perl_checker.src/parser_helper.ml
parenta40a84536bba545bb010a12aac632317545b40b9 (diff)
downloadperl-MDK-Common-d6ed071ca23941755671614ad566d3524d044f8b.tar
perl-MDK-Common-d6ed071ca23941755671614ad566d3524d044f8b.tar.gz
perl-MDK-Common-d6ed071ca23941755671614ad566d3524d044f8b.tar.bz2
perl-MDK-Common-d6ed071ca23941755671614ad566d3524d044f8b.tar.xz
perl-MDK-Common-d6ed071ca23941755671614ad566d3524d044f8b.zip
allow "*foo = sub {}" with no prototype
Diffstat (limited to 'perl_checker.src/parser_helper.ml')
-rw-r--r--perl_checker.src/parser_helper.ml12
1 files changed, 6 insertions, 6 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml
index c7290f5..e9a0398 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -565,7 +565,7 @@ let to_Local esp =
else if local_exprs = [] then My_our("local", local_vars, raw_pos2pos esp.pos)
else die_with_rawpos esp.pos "bad argument to \"local\""
-let sub_declaration (name, proto) body = Sub_declaration(name, proto, Block body)
+let sub_declaration (name, proto) body sub_kind = Sub_declaration(name, proto, Block body, sub_kind)
let anonymous_sub proto body = Anonymous_sub (proto, Block body.any, raw_pos2pos body.pos)
let call_with_same_para_special f = Call(f, [Deref(I_star, (Ident(None, "_", raw_pos2pos bpos)))])
let remove_call_with_same_para_special = function
@@ -608,19 +608,19 @@ let cook_call_op op para pos =
| "=", [ Deref(I_star, (Ident _ as f1)); Deref(I_star, (Ident _ as f2)) ] ->
let s1, s2 = string_of_Ident f1, string_of_Ident f2 in
warn pos (sprintf "\"*%s = *%s\" is better written \"*%s = \\&%s\"" s1 s2 s1 s2) ;
- sub_declaration (f1, None) [ call_with_same_para_special(Deref(I_func, f2)) ]
+ sub_declaration (f1, None) [ call_with_same_para_special(Deref(I_func, f2)) ] Glob_assign
| "=", [ Deref(I_star, Raw_string(sf1, pos_f1)); Deref(I_star, (Ident _ as f2)) ] ->
let s2 = string_of_Ident f2 in
warn pos (sprintf "\"*{'%s'} = *%s\" is better written \"*{'%s'} = \\&%s\"" sf1 s2 sf1 s2) ;
- sub_declaration (Ident(None, sf1, pos_f1), None) [ call_with_same_para_special(Deref(I_func, f2)) ]
+ sub_declaration (Ident(None, sf1, pos_f1), None) [ call_with_same_para_special(Deref(I_func, f2)) ] Glob_assign
| "=", [ Deref(I_star, (Ident _ as f1)); Ref(I_scalar, Deref(I_func, (Ident _ as f2))) ] ->
- sub_declaration (f1, None) [ call_with_same_para_special(Deref(I_func, f2)) ]
+ sub_declaration (f1, None) [ call_with_same_para_special(Deref(I_func, f2)) ] Glob_assign
| "=", [ Deref(I_star, Raw_string(sf1, pos_f1)); Ref(I_scalar, Deref(I_func, (Ident _ as f2))) ] ->
- sub_declaration (Ident(None, sf1, pos_f1), None) [ call_with_same_para_special(Deref(I_func, f2)) ]
+ sub_declaration (Ident(None, sf1, pos_f1), None) [ call_with_same_para_special(Deref(I_func, f2)) ] Glob_assign
| "=", [ Deref(I_star, (Ident _ as f1)); (Anonymous_sub(proto, sub, _)) ] ->
- sub_declaration (f1, proto) [ sub ]
+ sub_declaration (f1, proto) [ sub ] Glob_assign
| "||", e :: _ when is_always_true e -> warn_rule "<constant> || ... is the same as <constant>"; call
| "&&", e :: _ when is_always_false e -> warn_rule "<constant> && ... is the same as <constant>"; call