On Tuesday, 8 November 2022 at 02:55:34 UTC, max haughton wrote:
On Tuesday, 8 November 2022 at 00:05:18 UTC, vushu wrote:
Any where to find learning material for using dmd as a library?

thanks.

What do you want to do with it.

Im trying to understand the idiomatic way of using visitors, since I am interested in making some tooling. I tried to understand the code by looking into some bits and bites within dmd.

example:

```
auto someFunc() {
  return "hello";
}


```
I parsed it' using Parser!ASTCodegen
created a class which inherits SemanticTimeTransitiveVisitor and parsed it into.

I override visit(ASTCodegen.FuncDeclaration fd)

Now the question is:
If I want to deduce someFunc's return type I look at it's fd.type.nextOf value
in this case it's null since it's return type is set to auto.

what would be the right way of deducing that it's return type would be fact a string?

Should I just keep traversing and that way deduce the return type? or should I use other methods?
I see that the ASTCodegen.FuncDeclaration has a function named
```
functionSemantic();
```

which I thought I should use, but failed to.

So I do feel, that I am in need for some learning materials or guidance.




Reply via email to