Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing return type annotation (multiple instances) #49

Open
fskoras opened this issue Apr 20, 2023 · 2 comments
Open

Missing return type annotation (multiple instances) #49

fskoras opened this issue Apr 20, 2023 · 2 comments

Comments

@fskoras
Copy link

fskoras commented Apr 20, 2023

method parse should be annoted to return TranslationUnit
image

property cursor should be annotated to return Cursor class
image

I just gave 2 examples but there are many more instances where return type annotations would be helpful (especially while prototyping the code because without those PyCharm autocomplete is not working properly)

@JhnW
Copy link

JhnW commented Apr 20, 2023

I hope the maintainer of the project won't be offended by a bit of self-promotion.
The fact is that type hints are missing in many places, but even if they were, it won't improve your quality of life. I was going through it.
Why? It's good that you ask. This is due to the structure of the clang parser, which in 99% of cases returns two very generic types of cursors that you have to recognize each time by the kind field.
I don't know what code you need, but you can take a look at my devan project. I rely on libclang (at the type level) wrapping all those ugly cursor kind in nice type information plus throw in some clang filler with a bit of regex magic.

@fskoras
Copy link
Author

fskoras commented Apr 20, 2023

I'm trying to create a kind of source code Amalgamation that will consist of functions and declarations of global variables. The output of the tool must be self-contained, so the type definitions must also be resolved and sorted in the correct order. For this I use a topological sort algorithm. You can check out my repository if you're interested. I must confess that working on this project turned out to be more difficult than I initially imagined.

But I'm getting off topic. Just wanted to suggest an improvement to an already great package. Of course, it's up to the repository maintainer if he/she cares about such minor nuances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants