Libdparse needs to be updated to recognize AliasAssign declarations

user1234 user1234 at 12.de
Tue May 4 18:48:21 UTC 2021


On Tuesday, 4 May 2021 at 14:12:28 UTC, Paul Backus wrote:
> On Tuesday, 4 May 2021 at 14:07:47 UTC, WebFreak001 wrote:
>> however what about this code?
>> ```d
>> void foo() {
>>     alias A = B;
>>     A = C;
>> }
>> ```
>>
>> is the `A = C` in this case an AliasAssign? how would the 
>> parser differentiate between this AliasAssign and regular 
>> assignments?
>
> AliasAssign is only allowed in declaration contexts--the top 
> level of a module, or the body of a `struct`, `class`, 
> `template`, etc. In these contexts, a normal assignment 
> statement is not allowed, so there is no ambiguity.

Am i wrong to think that even without this rule the difference 
could be made during semantic by testing if the assign lhs is an 
alias ?



More information about the Digitalmars-d mailing list