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

Implement EXIT and CONTINUE loop control statements #241

Merged
merged 8 commits into from
Aug 16, 2021

Conversation

ulmer-a
Copy link
Collaborator

@ulmer-a ulmer-a commented Aug 13, 2021

This PR adds support for the EXIT and CONTINUE keywords in while and for loops and adds parser, codegen and correctness tests.

This will close #231 and close #236

@ulmer-a ulmer-a added this to the oscat milestone Aug 13, 2021
@codecov
Copy link

codecov bot commented Aug 13, 2021

Codecov Report

Merging #241 (e12fc45) into master (2966359) will increase coverage by 0.07%.
The diff coverage is 98.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #241      +/-   ##
==========================================
+ Coverage   95.03%   95.10%   +0.07%     
==========================================
  Files          35       35              
  Lines        9763     9987     +224     
==========================================
+ Hits         9278     9498     +220     
- Misses        485      489       +4     
Impacted Files Coverage Δ
src/ast.rs 90.66% <33.33%> (-0.67%) ⬇️
src/codegen/generators/statement_generator.rs 99.80% <100.00%> (+0.02%) ⬆️
src/parser/control_parser.rs 96.15% <100.00%> (+0.36%) ⬆️
tests/correctness/control_flow.rs 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 2966359...e12fc45. Read the comment docs.

Copy link
Collaborator

@ghaith ghaith left a comment

Choose a reason for hiding this comment

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

Looks good, but I think we could benefit from the following tests:

  • Codegen tests where the exit/continue is inside an IF nested in a loop
  • Correctness tests where the exit/continue is inside an IF nested in a loop (Should exit the loop)
  • Correctness test with two nested loops and an exit in the inner loop (Should not exit the outer loop)

@ulmer-a
Copy link
Collaborator Author

ulmer-a commented Aug 13, 2021

Should be covered now!

@ulmer-a ulmer-a requested a review from ghaith August 13, 2021 15:13
@ghaith ghaith merged commit 7615c93 into PLC-lang:master Aug 16, 2021
@ulmer-a ulmer-a deleted the loop_exit branch August 16, 2021 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Multiple returns in a row lead to unexpected behaviour on windows Support EXIT, CONTINUE and RETURN keywords
2 participants