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

feat: Topological sort of dependencies #114

Merged
merged 7 commits into from
Jun 9, 2021

Conversation

runeh
Copy link
Collaborator

@runeh runeh commented Jun 3, 2021

Sort roots topologically by their dependencies before generating code. Makes sure non-lazy types are written in the correct order.

I'll add a couple of more tests, but apart from that, this should be ready. This should land before releasing 3.0

@runeh runeh requested a review from simenandre June 3, 2021 11:02
@codecov-commenter
Copy link

codecov-commenter commented Jun 3, 2021

Codecov Report

Merging #114 (b8673c1) into main (1dba38f) will increase coverage by 20.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             main      #114       +/-   ##
============================================
+ Coverage   80.00%   100.00%   +20.00%     
============================================
  Files           2         2               
  Lines          35       256      +221     
  Branches        7        64       +57     
============================================
+ Hits           28       256      +228     
+ Misses          7         0        -7     
Impacted Files Coverage Δ
src/main.ts 100.00% <100.00%> (+22.58%) ⬆️
src/util.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c1a878f...b8673c1. Read the comment docs.

@runeh
Copy link
Collaborator Author

runeh commented Jun 5, 2021

@cobraz I need this to get released for some other experiments now :)

@runeh
Copy link
Collaborator Author

runeh commented Jun 7, 2021

Hmm. Found a couple of bugs to squash first.

Copy link
Owner

@simenandre simenandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this awesome feature!

Hmm. Found a couple of bugs to squash first.

I can't find any obvious bugs with this. Let me know if you want help with that!

@runeh
Copy link
Collaborator Author

runeh commented Jun 9, 2021

I can't find any obvious bugs with this. Let me know if you want help with that!

In both of the visitor functions in util, we throw. This crashes when dealing with unknown named types. Should probably just break and continue. But needs a test that triggers it before fixing

@runeh runeh merged commit f0a80b5 into main Jun 9, 2021
@runeh runeh deleted the topologocal-sort-of-non-cyclic-dependencies branch June 9, 2021 22:28
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

Successfully merging this pull request may close these issues.

3 participants