diff options
author | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-09-03 13:41:20 +0000 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-09-03 13:41:20 +0000 |
commit | 8d325ce78279a9da86468f175ebf8f1ec7617548 (patch) | |
tree | 96aa8c14879bbbeda06c0d51a1bd19add9c27176 | |
parent | ed65db6c6bc1b1e4dbabdf2bae93837e52fa7473 (diff) | |
download | perl-8d325ce78279a9da86468f175ebf8f1ec7617548.tar.gz |
Let Lint private_names catch out-of-package _foo methods.
p4raw-id: //depot/perlext/Compiler@52
-rw-r--r-- | B/Lint.pm | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -183,6 +183,15 @@ sub B::UNOP::lint { warning("Implicit scalar context for %s in %s", $ppaddr eq "pp_rv2av" ? "array" : "hash", $parent->desc); } + if ($check{private_names} && $ppaddr eq "pp_method") { + my $methop = $op->first; + if ($methop->ppaddr eq "pp_const") { + my $method = $methop->sv->PV; + if ($method =~ /^_/ && !defined(&{"$curstash\::$method"})) { + warning("Illegal reference to private method name $method"); + } + } + } } sub B::PMOP::lint { |