summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2014-01-22 19:35:55 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2014-01-22 19:36:18 +0100
commit50879dfa378febfb021b49070470e4446193e930 (patch)
treea2ccf3e71a05d2a595ec819671c7f02273ee3974
parent913aabb0ea27fe0e30b259e070e9ecd680bfc3bd (diff)
downloadperl_checker-50879dfa378febfb021b49070470e4446193e930.tar
perl_checker-50879dfa378febfb021b49070470e4446193e930.tar.gz
perl_checker-50879dfa378febfb021b49070470e4446193e930.tar.bz2
perl_checker-50879dfa378febfb021b49070470e4446193e930.tar.xz
perl_checker-50879dfa378febfb021b49070470e4446193e930.zip
fix "undeclared variable $_" false positive on List::Util::first()
-rw-r--r--NEWS1
-rw-r--r--src/global_checks.ml2
2 files changed, 2 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index a85af97..a3d686e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,4 @@
+- fix "undeclared variable $_" false positive on List::Util::first()
- fake packages:
o add Gtk3 & Gtk3::{Notify,WebKit}
diff --git a/src/global_checks.ml b/src/global_checks.ml
index 0140c44..b2c2a3e 100644
--- a/src/global_checks.ml
+++ b/src/global_checks.ml
@@ -285,7 +285,7 @@ let check_variables vars t =
Some vars
| Call(Deref(I_func, Ident(None, func, func_pos)), Anonymous_sub(_, Block f, pos) :: l)
- when List.mem func [ "grep" ; "map" ; "substInFile" ; "map_index" ; "each_index" ; "partition" ; "find_index" ; "grep_index" ; "find" ; "any" ; "every" ; "uniq_" ] ->
+ when List.mem func [ "grep" ; "map" ; "substInFile" ; "map_index" ; "each_index" ; "partition" ; "find_index" ; "grep_index" ; "find" ; "first" ; "any" ; "every" ; "uniq_" ] ->
let vars = List.fold_left check_variables_ vars l in
let vars' = { vars with my_vars = [] :: vars.my_vars ; our_vars = [(I_scalar, "_"), (pos, ref Access_various, None)] :: vars.our_vars } in
let vars' = List.fold_left check_variables_ vars' f in