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

fix: top sort var/const globals #1854

Merged
merged 17 commits into from
Apr 9, 2024
Merged

fix: top sort var/const globals #1854

merged 17 commits into from
Apr 9, 2024

Conversation

petar-dambovaliev
Copy link
Contributor

@petar-dambovaliev petar-dambovaliev commented Mar 28, 2024

This PR fixes this and this.

Before preprocessing, a dependency graph is created and edges between the nodes which represent the relationship between global var and const declarations.
Then, a new slice of declarations is created that is topologically sorted.
This enables the rest of the preprocessing code to work the way it is now.

Small scale refactoring is included by removing unnecessary else statements in PredefineFileSet.

@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Mar 28, 2024
@petar-dambovaliev petar-dambovaliev changed the title bug: top sort var/const globals fix: top sort var/const globals Mar 29, 2024
Copy link

codecov bot commented Mar 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.03%. Comparing base (84ba9c9) to head (fd9cea4).
Report is 31 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1854      +/-   ##
==========================================
- Coverage   47.49%   45.03%   -2.47%     
==========================================
  Files         388      464      +76     
  Lines       61305    68076    +6771     
==========================================
+ Hits        29117    30655    +1538     
- Misses      29750    34850    +5100     
- Partials     2438     2571     +133     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@petar-dambovaliev petar-dambovaliev marked this pull request as ready for review April 1, 2024 14:35
@petar-dambovaliev petar-dambovaliev requested review from zivkovicmilos and removed request for thehowl April 1, 2024 14:35
Copy link
Member

@zivkovicmilos zivkovicmilos 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 the fix 🙏

Left some comments, mostly questions

gnovm/pkg/gnolang/value_decl_dep_graph.go Outdated Show resolved Hide resolved
gnovm/pkg/gnolang/preprocess.go Show resolved Hide resolved
gnovm/pkg/gnolang/value_decl_dep_graph.go Outdated Show resolved Hide resolved
@zivkovicmilos
Copy link
Member

Pinged @deelawn / @ajnavarro for a second look 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

bug: var declaration definition loop
3 participants