digitalmars.D.learn - DMD: what's the proper way to get a list of symbols from a Module
- ryuukk_ (38/38) Mar 13 2023 Hello,
Hello, I am playing a little bit with DMD to get familiar with it (just to get a basic overview of it) I'm trying to come up with a proof of concept for https://github.com/dlang/DIPs/blob/master/DIPs/DIP1044.md ```D enum Tester { KNOWN = 1, WITHAUTO = 2 } void func(Tester a, Tester b) { } void main() { func(Tester.KNOWN, auto.WITHAUTO); } ``` The idea is to reuse auto, basically do like tuple, create a ``StructDeclaration`` and inside put a ``VarDeclaration`` just to remember what is the identifier, then once it tries to search for the symbol, we hijack it and try to search globally instead I came up with this: https://github.com/ryuukk/dmd/commit/cb86d398b68501fd334c090745e946db7b27ff97 It seems to follow the logic i have in mind, the problem is whenever i try to search for the symbol given the identifier i saved I had to set the module as parent of the ``StructDeclaration`` created to get a starting point The problem is the field ``members`` from ``Module`` only seems to list ``object`` module when it is trying to search for the symbol There should also be ``Tester`` with should be an ``EnumDeclaration``, why is it not listed? Am i doing something incorrect (that's probably the case) Anyway, i'm blind at this point, if someone could provide some guidance, that would be kind of you!
Mar 13 2023