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

Handle for loops #87

Open
wargio opened this issue Aug 14, 2018 · 0 comments
Open

Handle for loops #87

wargio opened this issue Aug 14, 2018 · 0 comments

Comments

@wargio
Copy link
Owner

wargio commented Aug 14, 2018

for loops are easy to detect:

do {
    ops
    ops
    ops
    [...]
// can be here an if or a label, if there's one
// then there could be a for loop.
    add // incrementer
    sub // decrementer
} while(cond);

Edits goes only under controlflow.js. Probably is possible to only edit the while detection code in order to enhance it to support for logic.

the algorithm should be like for the while:

[...]
type is do-while
if jumps into do-while loop then type is while;
if between previous jump-label and while-jump there are math or calls ops that (no compare ops) then type is for-loop (with or without iterators, e.g. c++ iterators) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant