summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-10-01 14:42:52 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-10-01 14:42:52 +0000
commit0da64a7f8a7ef155a211d923e67b54878855ee75 (patch)
treec7f7895f017cc9cf07341f8aff53a404029ba27f
parent28078989d8ad0cd5303aadb8ba86583bebc26586 (diff)
downloadperl_checker-0da64a7f8a7ef155a211d923e67b54878855ee75.tar
perl_checker-0da64a7f8a7ef155a211d923e67b54878855ee75.tar.gz
perl_checker-0da64a7f8a7ef155a211d923e67b54878855ee75.tar.bz2
perl_checker-0da64a7f8a7ef155a211d923e67b54878855ee75.tar.xz
perl_checker-0da64a7f8a7ef155a211d923e67b54878855ee75.zip
warn: foreach (%xxx) { ... }
-rw-r--r--perl_checker.src/parser_helper.ml2
1 files changed, 2 insertions, 0 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml
index 29bb971..d12a43e 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -452,6 +452,8 @@ let check_for_foreach esp arg =
if esp.any = "foreach" then warn esp.pos "you are using the special fpons trick to locally set $_ with a value, for this please use \"for\" instead of \"foreach\""
| List [ Deref_with(context, I_scalar, _, _) ] when context <> I_func ->
if esp.any = "foreach" then warn esp.pos "you are using the special fpons trick to locally set $_ with a value, for this please use \"for\" instead of \"foreach\""
+ | List [ Deref(I_hash, _) ] ->
+ warn esp.pos "foreach with a hash is usually an error"
| _ ->
if esp.any = "for" then warn esp.pos "write \"foreach\" instead of \"for\""