-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
Fix Issue 7016 - local import does not create -deps dependency #6468
Conversation
|
Awesome, been waiting for this for a long time.
|
This commit solves the problem of infinite recursion caused by cyclic imports. I am not sure if this feature should be activated by another flag since by definition the "-deps" flag should list all dependencies (either local or global). A problem which I noticed is that if a module imports the same module N times in different scopes, the import is printed N times (this was true for the older version also). I am not sure if this is the de facto standard or it should be fixed, but either way that is a different problem. A different question is : should std.* core.* and etc.* imports be ignored? Or should an --include/--exclude flag be added? Any suggestions are welcome. |
*/ | ||
private void semantic3OnDependencies(Module m, bool[string] importArray) | ||
{ | ||
import std.conv : to; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calling phobos inside dmd is a nono.
Since you are already using AA's you might as well use the dmd internal hash-table for strings.
it's in root.
/** | ||
* Recursevely call semantic3() on import tree nodes. | ||
*/ | ||
private void semantic3OnDependencies(Module m, bool[string] importArray) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh noes,
this is going to slow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced the AA with the string-key hashtable in root.springtable. Hope it's ok now. Thanks for the tip
I made a separate pool request that erases all ddmd. prefixes. For this PR I needed to import ddmd.root.stringtable, so I'm guessing there's gonna be some conflicts. I think that the faster #6489 is merged, the better. |
@MartinNowak I have no idea why the tests are failing. Locally, I don't have any problems when running the tests. |
@timotheecour do you think that if -deps is used in conjunction with -unittest, should the dependencies of unittests be printed too? |
unittest blocks should be treated as normal functions in that regard, so yes. That way, when rdmd uses
|
Semantic3 wasn't called on module dependencies, so I added a function which recursively calls it on the import tree. I may need some help adding tests