-
Notifications
You must be signed in to change notification settings - Fork 166
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
Failing parse on nested with-statements. #104
Comments
Olof-Joachim Frahm notifications@github.com wrote:
I guess both of these cases are due to rope/refactor/patchedast.py.
|
Actually since I've now stepped through it, the second one works if
Yes, so what if there is no corresponding part of the source code? The second |
Olof-Joachim Frahm notifications@github.com wrote:
Sorry, I did not read your first message fully. Do you
and:
are parsed exactly the same way (node.optional_vars in _With If so, a workaround may be to do something like semicolon_or_as_in_except
|
Nested with statements. Fix issue #104
I've uploaded
this commit with two failing teststhis commit with one failing test case which, one just fails to refactor correctly, the otherraises an exception because(?)the source code doesn't exactly match the AST, i.e.:fails to parse; there is a second (nested)
with
node in the AST, but in_Source.consume
/patchedast.py:643
theself.offset
is at the end of the line and couldn't match a second, non-existentwith
anyway.The other, simpler case is a regular nested `with`, i.e. extracting a method from the following code (the `print` line):
will refactor (and miss the two variables) to:
I'm pretty sure I can figure out the second case, but for the first I'm at a loss how to start fixing it. Any pointers?
Edit: I've changed the one test case to reflect the working behaviour with the added
global_
flag.The text was updated successfully, but these errors were encountered: