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:35:55 +0100
commit804b1b3d0d262d0dc01862274c5048d574ae8008 (patch)
treea2ccf3e71a05d2a595ec819671c7f02273ee3974
parent8f071b6ee5c5879b43489f0893438b807bf28a13 (diff)
downloadperl_checker-804b1b3d0d262d0dc01862274c5048d574ae8008.tar
perl_checker-804b1b3d0d262d0dc01862274c5048d574ae8008.tar.gz
perl_checker-804b1b3d0d262d0dc01862274c5048d574ae8008.tar.bz2
perl_checker-804b1b3d0d262d0dc01862274c5048d574ae8008.tar.xz
perl_checker-804b1b3d0d262d0dc01862274c5048d574ae8008.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