Skip to content

Draft: Added TemplateDeclaration to DUChain

Jaap Geurts requested to merge jaapgeurts/kdevelop:dlang-integration into master

I'm working on getting better DLang integration into KDevelop. I've used Thomas-Brix Larsen's project (https://github.com/ThomasBrixLarsen/kdev-dlang) and improved it and made it work with the latest version of KDevelop (repo here: https://github.com/jaapgeurts/kdev-dlang).

When I started improving on the features I was missing the capability to show and keep DUChain Use information about a template. The reason for this merge request is to add this functionality.

Why is it needed? Dlang supports Templates that have scopes. It is useful to keep track of that information in a separate Object. E.g.

template example(T) {
  T num;

  T func(T a) { return a; }
}

This template has two members and can be used as follows:

example!int.num = 5;

or

writeln("The value is twelve: " , example!int.func(12);

As can be seen here. Templates have their own scope and much information is stored about them. This is different from C++.

If there are other or better ways to do this, perhaps you can help or give some pointer on where to look. Thanks

Edited by Jaap Geurts

Merge request reports