From 3d726d18053a2ea9cf435d661fc6fd0a36daab99 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 30 Apr 2003 09:30:59 +0000 Subject: allow "*foo = sub {}" with no prototype --- perl_checker.src/parser_helper.ml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'perl_checker.src/parser_helper.ml') 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 " || ... is the same as "; call | "&&", e :: _ when is_always_false e -> warn_rule " && ... is the same as "; call -- cgit v1.2.1