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: refactor if-end jump logic #14

Merged
merged 2 commits into from
Nov 8, 2023

Conversation

mrLSD
Copy link
Owner

@mrLSD mrLSD commented Nov 7, 2023

Description

Refactored if-end jump logic for if-condition state. Related to issue #9.

If-body block state

For the if-body block state, when called return anyway after this the JumpTo if-end instruction is called. It's redundant, refactored, and added an additional checks for label instruction JumpTo is manual-return for the current block state. If manual-return is set JumpTo context instruction is removed.

function-body block state

For the function-body block state should be added an additional check for manual-return. If it is set to true add the label return before the return instruction and also add the return instruction itself.

Other cases

  • Checked the same cases for the if-else statement and refactored.
  • Checked the same cases for the if-else-if statement - doesn't exist.
  • Checked the same cases for the loop statement, as a conclusion: it's the only case for the if-condition statement.

@mrLSD mrLSD self-assigned this Nov 7, 2023
@mrLSD mrLSD added the enhancement New feature or request label Nov 7, 2023
@mrLSD mrLSD added this to the v0.2.5 milestone Nov 7, 2023
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
src/semantic.rs 100.00% <100.00%> (ø)
tests/if_tests.rs 100.00% <100.00%> (ø)
tests/main_tests.rs 100.00% <100.00%> (ø)

📢 Thoughts on this report? Let us know!

@mrLSD mrLSD merged commit 7e8883a into master Nov 8, 2023
4 checks passed
@mrLSD mrLSD deleted the feat/improve-return-for-body-statements branch November 8, 2023 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant