diff options
author | bscan <10503608+bscan@users.noreply.github.com> | 2023-10-15 15:04:58 -0400 |
---|---|---|
committer | bscan <10503608+bscan@users.noreply.github.com> | 2023-10-15 15:04:58 -0400 |
commit | 980a742e4bd5c9d1d6b8b18f7d78543df23ba751 (patch) | |
tree | 7a1f1f162f3367bd4bbfa67173e0db852062926b /testWorkspace | |
parent | fd7bcca5b20462a46563122bcefef4d91e7574a5 (diff) | |
download | PerlNavigator-980a742e4bd5c9d1d6b8b18f7d78543df23ba751.zip |
Refine elements in Navigation which fixes off by 1 errors, and allows finding Moo attributes
Find subs like Foo->new()->func
Lookup package locations by finding contained subroutines
Close subroutine signatures at ), and fix signatures for corinna methods
Diffstat (limited to 'testWorkspace')
-rw-r--r-- | testWorkspace/MyLib/Corinna.pm | 18 | ||||
-rw-r--r-- | testWorkspace/MyLib/MyClass.pm | 2 | ||||
-rw-r--r-- | testWorkspace/mainTest.pl | 11 |
3 files changed, 29 insertions, 2 deletions
diff --git a/testWorkspace/MyLib/Corinna.pm b/testWorkspace/MyLib/Corinna.pm new file mode 100644 index 0000000..c4114bc --- /dev/null +++ b/testWorkspace/MyLib/Corinna.pm @@ -0,0 +1,18 @@ +use v5.38; +use experimental 'class'; +class MyLib::Corinna; + +field $x :param = 0; +field $y :param = 0; + +method move ($dX, $dY) { + $x += $dX; + $y += $dY; +} + + +method describe () { + print "A point at ($x, $y)\n"; +} + +1; diff --git a/testWorkspace/MyLib/MyClass.pm b/testWorkspace/MyLib/MyClass.pm index 7d91105..e581f96 100644 --- a/testWorkspace/MyLib/MyClass.pm +++ b/testWorkspace/MyLib/MyClass.pm @@ -24,6 +24,8 @@ sub duplicate_method_name { } +*dynamic = sub { print "Dynamic\n" }; + my $genWarning; my $genWarning; diff --git a/testWorkspace/mainTest.pl b/testWorkspace/mainTest.pl index 9a1d819..c690275 100644 --- a/testWorkspace/mainTest.pl +++ b/testWorkspace/mainTest.pl @@ -23,7 +23,7 @@ use MyLib::ClassAccessor; use MyLib::ClassTiny; use MyLib::ObjectTiny; use MyLib::MarsExample; - +use MyLib::Corinna; use MySubClass; @@ -106,12 +106,14 @@ print encode_base64($0) . "\n"; print "\n ------ Methods and Attributes ------\n"; + my $testObj = MyLib::MyClass->new(); $testObj->overridden_method(); +$testObj->dynamic(); my $subObj = MySubClass->new(); $subObj->overridden_method(); -$subObj->inherited_method(); +$subObj->inherited_method(2,3); my $otherObj = MyLib::MyOtherClass->new(); $otherObj->unique_method_name(); @@ -120,6 +122,8 @@ $otherObj->duplicate_method_name(); my $unknownObj = $otherObj; # Type hints: $unknownObj isa MyLib::MyOtherClass $unknownObj->duplicate_method_name(); +MyLib::MyOtherClass->new($my_scalar)->duplicate_method_name(); + my $mooObj = MyLib::MooClass->new(); $mooObj->moo_sub(); print $mooObj->moo_attrib . "\n"; @@ -152,6 +156,9 @@ my $marsObj = MyLib::MarsExample->new(foo=>10); print $marsObj->foo(20); print $marsObj->foo; +my $corinna = MyLib::Corinna->new(); +$corinna->move(2,3); + use attributes (); print "ObjectPad attributes: " . attributes::get(\&MyLib::ObjectPad::describe) . "\n"; |