diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-04-30 09:30:59 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-04-30 09:30:59 +0000 |
commit | 3d726d18053a2ea9cf435d661fc6fd0a36daab99 (patch) | |
tree | 64406beefbf9d941a955d72f33dcb1f5d8ef15cf /perl_checker.src/parser_helper.ml | |
parent | 16d1e7e21e4169abd573a3b6e53afb4a203a81f2 (diff) | |
download | perl_checker-3d726d18053a2ea9cf435d661fc6fd0a36daab99.tar perl_checker-3d726d18053a2ea9cf435d661fc6fd0a36daab99.tar.gz perl_checker-3d726d18053a2ea9cf435d661fc6fd0a36daab99.tar.bz2 perl_checker-3d726d18053a2ea9cf435d661fc6fd0a36daab99.tar.xz perl_checker-3d726d18053a2ea9cf435d661fc6fd0a36daab99.zip |
allow "*foo = sub {}" with no prototype
Diffstat (limited to 'perl_checker.src/parser_helper.ml')
-rw-r--r-- | perl_checker.src/parser_helper.ml | 12 |
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 |