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

ENH: Add support for decompiling if-statements. #28

Merged
merged 2 commits into from
Dec 11, 2015
Merged

Conversation

ssanderson
Copy link
Collaborator

This is mostly interesting because it's tricky to tell the difference between an if statement and a short-circuiting operator or a ternary. The key to figuring out that we're in an if statement is looking at the cumulative stack effect between a jump and its target. It's zero only when we're in a jump generated by an if.

takewhile(op.is_not(instr.arg), queue)
)
)
if stack_effect_until_target == 0:
Copy link
Owner

Choose a reason for hiding this comment

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

I would invert this check, if not eq 0, then raise

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is temporary logic anyway. The other case is ternary/short-circuiting operators.

@llllllllll
Copy link
Owner

I don't understand why travis isn't running the tests for prs anymore

@llllllllll
Copy link
Owner

lgtm though

ssanderson pushed a commit that referenced this pull request Dec 11, 2015
ENH: Add support for decompiling if-statements.
@ssanderson ssanderson merged commit 6e5337a into master Dec 11, 2015
@ssanderson ssanderson deleted the branches branch December 11, 2015 03:15
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.

None yet

2 participants