summaryrefslogtreecommitdiffstats
path: root/perl_checker.src
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
commit0105abc5c976593b7b775fa2200bb0b7432d98f8 (patch)
treec464e0f607d4fa79784f884a0d8841a21124d982 /perl_checker.src
parent9c32c506136dec6694675f66e869eeea28e5ce3c (diff)
downloadperl-MDK-Common-0105abc5c976593b7b775fa2200bb0b7432d98f8.tar
perl-MDK-Common-0105abc5c976593b7b775fa2200bb0b7432d98f8.tar.gz
perl-MDK-Common-0105abc5c976593b7b775fa2200bb0b7432d98f8.tar.bz2
perl-MDK-Common-0105abc5c976593b7b775fa2200bb0b7432d98f8.tar.xz
perl-MDK-Common-0105abc5c976593b7b775fa2200bb0b7432d98f8.zip
better warning for: print $a . 'foo'
Diffstat (limited to 'perl_checker.src')
-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_ =