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

Add with statement support to blocks #121

Merged

Conversation

cbisnett
Copy link
Contributor

@cbisnett cbisnett commented Feb 17, 2017

Added support for automatically scoping blocks using Python's with statement. For example what used to be written like this:

if s_block_start("myblock"):
    s_string("foobar")
    ...
s_block_end()

Can now be simplified to this:

with s_block("myblock"):
    s_string("foobar")
    ...

This change is Reviewable

@cbisnett
Copy link
Contributor Author

Actually now that I think about it, the default argument values aren't being passed when calling through s_block_start(). I'll update the branch.

@jtpereyda
Copy link
Owner

Very cool! Did you do a manual run of unit_test/blocks.py? I don't think it is included in the automatically run tests; IIRC some of them weren't passing, but if the new test you wrote is passing, that's probably fine.

@jtpereyda
Copy link
Owner

I would try now but I'm having issues on my current system.

@jtpereyda
Copy link
Owner

I got my system up and tested it. Good to go. Thank you for the contributions! Feel free to add yourself to the CONTRIBUTORS.txt file.

@jtpereyda jtpereyda merged commit c07f04d into jtpereyda:master Feb 17, 2017
@cbisnett cbisnett deleted the add_with_statement_support_to_blocks branch February 17, 2017 14:18
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