summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-05-26 14:12:19 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-05-26 14:12:19 +0000
commit7c7d7bec4eca414b9eda728f4e227af7f6cbba7c (patch)
tree6b4e3931df70e5ac8eb5985ed077d85260b43413
parentcb79314a713769a18a76dddeb1eb393452e584ef (diff)
downloadperl_checker-7c7d7bec4eca414b9eda728f4e227af7f6cbba7c.tar
perl_checker-7c7d7bec4eca414b9eda728f4e227af7f6cbba7c.tar.gz
perl_checker-7c7d7bec4eca414b9eda728f4e227af7f6cbba7c.tar.bz2
perl_checker-7c7d7bec4eca414b9eda728f4e227af7f6cbba7c.tar.xz
perl_checker-7c7d7bec4eca414b9eda728f4e227af7f6cbba7c.zip
better warning for: print $a . 'foo'
-rw-r--r--perl_checker.src/parser_helper.ml6
1 files changed, 5 insertions, 1 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml
index 5468c3a..b2726e4 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -237,7 +237,11 @@ let prio_lo pri_out in_ =
prio_less(pri_in', pri_out) && not_complex (un_parenthesize in_.any.expr) then
warn in_.pos "unneeded parentheses"
| _ -> ())
- else warn in_.pos "missing parentheses (needed for clarity)" ;
+ else
+ (match in_.any.expr with
+ | Call_op ("print", [Deref (I_star, Ident (None, "STDOUT", _)); Deref(I_scalar, ident)], _) ->
+ warn in_.pos (sprintf "use parentheses: replace \"print $%s ...\" with \"print($%s ...)\"" (string_of_Ident ident) (string_of_Ident ident))
+ | _ -> warn in_.pos "missing parentheses (needed for clarity)") ;
in_.any.expr
let prio_lo_after pri_out in_ =