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

Introduce `returnif` to babel parser & generator #4

Open
wants to merge 5 commits into
base: original
from
Open

Conversation

@adamlouis
Copy link
Owner

adamlouis commented Jul 22, 2018

Check out the full post here: https://suczewski.com/2018/07/returnif

returnif allows one to conditionally return from a function based on 1) the truthiness of the value to be returned or 2) a precondition. Here I've done part 1. To do this I:

  • I added a few lines to interpret returnif similar to return. Their declarations and representations in the AST are the same for case 1.

  • Use hash of the AST node as the suffix for a temp variable name to generate plain js

adamlouis and others added 5 commits Jul 21, 2018
add `option_return` proof of concept hack to parser and generator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.