summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/parser_helper.ml
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-12-16 21:02:51 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-12-16 21:02:51 +0000
commit86905dc107c2eaa070465392e3fd5df285204efe (patch)
tree3c6497d080017bcb49aa48d52e3b5f42f60358f3 /perl_checker.src/parser_helper.ml
parent1d6df1fbb9a571f020c10d071ff4dba4f65a97f1 (diff)
downloadperl_checker-86905dc107c2eaa070465392e3fd5df285204efe.tar
perl_checker-86905dc107c2eaa070465392e3fd5df285204efe.tar.gz
perl_checker-86905dc107c2eaa070465392e3fd5df285204efe.tar.bz2
perl_checker-86905dc107c2eaa070465392e3fd5df285204efe.tar.xz
perl_checker-86905dc107c2eaa070465392e3fd5df285204efe.zip
- pop behaves just like shift
- check that the parameter to pop & shift is an array, and not more parameters are given
Diffstat (limited to 'perl_checker.src/parser_helper.ml')
-rw-r--r--perl_checker.src/parser_helper.ml10
1 files changed, 8 insertions, 2 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml
index ffe4abf..1a54536 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -333,7 +333,7 @@ let word_alone esp =
| "arch" | "quotemeta" | "lc" | "lcfirst" | "uc" | "ucfirst" -> M_string
| "split" -> M_array
- | "shift" -> M_scalar
+ | "shift" | "pop" -> M_scalar
| "die" | "return" | "redo" | "next" | "last" -> M_unknown
| "caller" -> M_mixed [M_string ; M_list]
@@ -822,6 +822,12 @@ let call_raw force_non_builtin_func (e, para) =
warn_rule "you can replace \"member($xxx, keys %yyy)\" with \"exists $yyy{$xxx}\""
| _ -> ());
None
+
+ | "pop" | "shift" ->
+ (match para with
+ | []
+ | [ Deref(I_array, _) ] -> ()
+ | _ -> warn_rule (f ^ " is expecting an array and nothing else")) ; None
| _ -> None
in Call(e, some_or para' para)
@@ -861,7 +867,7 @@ let call_one_scalar_para { any = e ; pos = pos } para esp_start esp_end =
let para =
match para with
| [] ->
- if e = "shift" then
+ if e = "shift" || e = "pop" then
[] (* can't decide here *)
else
(if not (List.mem e [ "length" ]) then warn_rule (sprintf "please use \"%s $_\" instead of \"%s\"" e e) ;