[RFC] Parse errors w/Constructor Property Promotion?
| From: | Mike Schinkel | Date: | Sat, 04 Apr 2020 07:51:16 +0000 |
| Subject: | [RFC] Parse errors w/Constructor Property Promotion? | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109527@lists.php.net to get a copy of this message | ||
Question: Will parse errors in the __construct() be reported as all being on the same line, or will
the parser report each as a distinct line of code when reporting parse errors?
-Mike
> On Apr 2, 2020, at 9:52 AM, Nikita Popov <nikita.ppv@gmail.com> wrote:
>
> 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