summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/parser_helper.ml
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-12-05 20:28:02 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-12-05 20:28:02 +0000
commit85c25a40f213bba1a0834f7612985d83c9374c7f (patch)
tree3f515f789a248df922c6cf419ca0f0207eab5c85 /perl_checker.src/parser_helper.ml
parent87276fe6b8ee2169df194dc58faf5b772424d619 (diff)
downloadperl_checker-85c25a40f213bba1a0834f7612985d83c9374c7f.tar
perl_checker-85c25a40f213bba1a0834f7612985d83c9374c7f.tar.gz
perl_checker-85c25a40f213bba1a0834f7612985d83c9374c7f.tar.bz2
perl_checker-85c25a40f213bba1a0834f7612985d83c9374c7f.tar.xz
perl_checker-85c25a40f213bba1a0834f7612985d83c9374c7f.zip
create to_Deref_with_arrow()
Diffstat (limited to 'perl_checker.src/parser_helper.ml')
-rw-r--r--perl_checker.src/parser_helper.ml9
1 files changed, 6 insertions, 3 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml
index c0d27f1..731b78f 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -496,10 +496,9 @@ let check_hash_subscript esp =
| List [Raw_string(s, _)] when can_be_raw_string s -> warn [Warn_suggest_simpler] esp.pos (sprintf "{'%s'} can be written {%s}" s s)
| _ -> ()
-let check_arrow_needed esp1 esp2 =
- match esp1.any.expr with
+let check_arrow_needed arrow = function
| Deref_with(I_array, I_scalar, List [List [Call _]], _) -> () (* "->" needed for (f())[0]->{XX} *)
- | Deref_with _ -> warn [Warn_suggest_simpler] esp2.pos "the arrow \"->\" is unneeded"
+ | Deref_with _ -> warn [Warn_suggest_simpler] arrow.pos "the arrow \"->\" is unneeded"
| _ -> ()
let check_scalar_subscripted esp =
@@ -672,6 +671,10 @@ let to_Deref_with(from_context, to_context, ref_, para) =
if is_not_a_scalar ref_ then warn_rule [] "bad deref";
Deref_with(from_context, to_context, ref_, para)
+let to_Deref_with_arrow arrow (from_context, to_context, ref_, para) =
+ if from_context != I_func then check_arrow_needed arrow ref_ ;
+ to_Deref_with(from_context, to_context, ref_, para)
+
let lines_to_Block esp_lines esp_BRACKET_END =
check_block_lines esp_lines esp_BRACKET_END;
Block (fst esp_lines.any)