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 issues #91 #122 #257

Closed
wants to merge 3 commits into from
Closed

Fix issues #91 #122 #257

wants to merge 3 commits into from

Conversation

4144
Copy link
Contributor

@4144 4144 commented Aug 16, 2021

Fix for loop exit with break in translator engine (fixes #91, #122)
Add github actions for run tests.

If actions not started on this pull request, here results from my fork:
With fix: https://github.com/4144/Js2Py/runs/3335639115
Without fix: https://github.com/4144/Js2Py/runs/3335627897

@PiotrDabkowski
Copy link
Owner

Thanks a lot, the github actions change is really cool! Could you prepare a dedicated PR for this? I will merge it :)

Regarding the for loop fix, the problem very tricky and has many non-trivial edge cases. For example your solution will end up in the infinite loop for the following code:

for (var i=0;i<10;i++) {
  while (1) {
    break
  }
}

Translated python code would be:

while (var.get('i')<Js(10.0)):
    FORBREAKVAR = False
    try:
        while Js(1.0):
            FORBREAKVAR = True;
            break
    finally:
        if FORBREAKVAR is False:
            (var.put('i',Js(var.get('i').to_number())+Js(1))-Js(1))
        FORBREAKVAR = False

There are also complications like labels that should be handled as well.

I have created the PR #267 that will fix it, hopefully without some unexpected edge cases :)

@4144
Copy link
Contributor Author

4144 commented Sep 16, 2021

here pr with only github actions #268

@4144
Copy link
Contributor Author

4144 commented Sep 16, 2021

can you remove codeclimate integration? because it always failing all error sign to all prs?

@4144
Copy link
Contributor Author

4144 commented Sep 16, 2021

and i closing this pr

@4144 4144 closed this Sep 16, 2021
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.

Bug with break in a for loop
2 participants