Mixin analysis support for templated arguments possible?

Rainer Schuetze r.sagitario at gmx.de
Sat Mar 2 08:09:00 UTC 2019



On 01/03/2019 21:17, jacobkemple wrote:
> So below, if I type  "t." in visual D pops intellisense parses it right
> and it shows example1 as a ubyte, however, if I set it to lets say
> foo!T[] (or anything else templated) intellisense breaks support for
> mixins in this situation despite the code working.
> 
> mixin template StructVar(int offset, T, string name)
> {
>     mixin("struct {"
>           ~ "private ubyte[" ~ offset.stringof ~ "] _;"
>           ~ T.stringof ~ " " ~ name ~ ";"
>           ~ "}");
> }
> 
> unittest
> {
>     struct TestStruct
>     {
>         union
>         {
>             mixin StructVar!(0x10, ubyte, "example1");
>         }
>     }
> 
>     TestStruct t;
>     t.example1 = 0x71;
> }
> 
> 
> 
> Future support possible or is it a bug by any chance? Looked at the code
> on github but fairly complicated to dive into mixin analysis wise.

Don't expect wonders, but this problem is "just" that the stringof
property of template instances doesn't evaluate to the correct string,
i.e. "foo" instead of "foo!int".

This should help for the next release:
https://github.com/aBothe/D_Parser/pull/218


More information about the Digitalmars-d-ide mailing list