[SAoC2022] Replace libdparse with dmd-as-a-library in D-Scanner

user1234 user1234 at 12.de
Wed Dec 14 15:50:16 UTC 2022


On Wednesday, 14 December 2022 at 15:43:53 UTC, user1234 wrote:
> On Tuesday, 13 December 2022 at 17:31:46 UTC, Lucian Danescu 
> wrote:
>> Hello!
>>
>> [...]
>>>>Here is an example of "troublesome" code for this check:
>> ```
>> void f()
>> {
>>     version (Windows)
>>         int a;
>>
>>     static if (true)
>>         version (POSIX)
>>             int a;
>>         else
>>             int b;
>> }
>> ```
>> My implementation would wrongly issue a warning in this 
>> scenario. If anyone would have any suggestions on how to go 
>> about this it would be awesome.
>
> The dparse-based implementation assumes that the version 
> condition are awlays true and in consequence it ignores 
> everything that's declared in the "else" blocks. You must have 
> missed something in the DMDFE version of the AST but to be fair 
> at first glance your translation looks faithful.
>
> But in any case the way it works now is not correct either so 
> I'd advice to skip entirely static conditions and versions. It 
> will be possible to handle these two cases the day the 
> semantics will be run.

About the second problematic check I think that @property checks 
can be disabled for now (as you wanted to do) as this attribute 
is considered by users as almost useless.

In both cases the idea is to move forward, just keep track of the 
problems using issues or code comments.


More information about the Digitalmars-d mailing list