Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostfixDeref: direct dereference #15

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

zmughal
Copy link

@zmughal zmughal commented Aug 11, 2022

This is implemented on top of #12.

  • PostfixDeref: directly dereference instead of using map

Fixes #13.

zmughal and others added 7 commits August 8, 2022 20:03
With the release of PPR v0.001000 there is a backwards incompatible
change in the definition of the `PerlTerm` rule to include postfix
arrows for dereferencing and methods.

This affects the plugin(s):

    $ git grep -lP '\b(Perl)?(Term|((ScalarAccess|ArrayAccess)(NoSpace)?))' lib/
    lib/Babble/Plugin/PostfixDeref.pm
Newer PPR handles the postfix dereference in `PerlTerm` while
`PerlScalarAccess` handles indexing without any arrows.

This also addresses the issue of <shadow-dot-cat#3>.
This adds the tests from that PR (djerius++).

Co-authored-by: Diab Jerius <[email protected]>
For PostfixDeref that is interpolated in quote-likes.
Using `map` to translate the postfix subscripts does not work with
`push`, `pop`, `shift`, `unshift`, `splice`, and other built-ins that
modify the parameter as the `map` is using a copy.

This change makes the translation of
```perl
$foo->$*
```
into
```perl
${ $foo }
```
instead of
```perl
(map $$_, $foo)[0]
```

Fixes <shadow-dot-cat#13>.
zmughal added a commit to zmughal/Babble that referenced this pull request Sep 4, 2022
…-access

PostfixDeref: direct dereference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PostfixDeref: translation using map construct does not work with push, etc
1 participant