Re: [RFC] Constructor Property Promotion
| From: | Nikita Popov | Date: | Thu, 02 Apr 2020 13:52:13 +0000 |
| Subject: | Re: [RFC] Constructor Property Promotion | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109515@lists.php.net to get a copy of this message | ||
On Thu, Apr 2, 2020 at 3:47 PM Markus Fischer <markus@fischer.name> wrote:
> Him
>
> On 02.04.20 12:07, Nikita Popov wrote:
> > Reflection will see the state after desugaring. That is, it just sees
> > normal properties and normal constructor args. I've made this more
> explicit
> > in the RFC now:
> https://wiki.php.net/rfc/constructor_promotion#reflection
>
> Thanks!
>
> Another one, also related a bit to your PHP-Parser (?): will the
> tokenization process "see" the code before desugaring?
>
> I'm wondering how automated translation tool can detect that a certain
> code is not "sugared" and promote this?
>
Tokenization and parsing both happen before the desugaring, they see the
code in its original form. They would detect promoted properties by
checking whether a constructor parameter has a visibility modifier. Of
course, tooling might want to perform the desugaring transformation
internally, so it sees a uniform representation of everything.
Regards,
Nikita