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
commit03308c3b52cab6cafdb5584b6fa6b367b73a740f (patch)
tree37c8f8a4ddd8ac25b7ce56c22d427a4ab0d12a24 /perl_checker.src/parser_helper.ml
parente7884d3a3cf3b0cc2bea836dc5040b7a157bc39d (diff)
downloadperl-MDK-Common-03308c3b52cab6cafdb5584b6fa6b367b73a740f.tar
perl-MDK-Common-03308c3b52cab6cafdb5584b6fa6b367b73a740f.tar.gz
perl-MDK-Common-03308c3b52cab6cafdb5584b6fa6b367b73a740f.tar.bz2
perl-MDK-Common-03308c3b52cab6cafdb5584b6fa6b367b73a740f.tar.xz
perl-MDK-Common-03308c3b52cab6cafdb5584b6fa6b367b73a740f.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)