Fix Issue 7016 - local import does not create -deps dependency#6468
Fix Issue 7016 - local import does not create -deps dependency#6468RazvanN7 wants to merge 3 commits intodlang:masterfrom
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. |
src/mars.d
Outdated
| */ | ||
| private void semantic3OnDependencies(Module m, bool[string] importArray) | ||
| { | ||
| import std.conv : to; |
There was a problem hiding this comment.
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.
src/mars.d
Outdated
| /** | ||
| * Recursevely call semantic3() on import tree nodes. | ||
| */ | ||
| private void semantic3OnDependencies(Module m, bool[string] importArray) |
There was a problem hiding this comment.
Oh noes,
this is going to slow.
There was a problem hiding this comment.
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