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

Make Expression and Statement separable #2209

Merged
merged 3 commits into from
Oct 3, 2016

Conversation

elazarg
Copy link
Contributor

@elazarg elazarg commented Oct 2, 2016

This is a bigger change than previous PRs related to #1783, so yeah, much churn :( This is mostly due to the need to split visit_list() to deal separately with Expression and Statement, and similarly for .node(), .nodes() etc. I think it is unavoidable.

The good news:

  1. Expression and Statement can be separated, although in this PR they are still aliases, to be safe. To test this change, make Expression and Statement subclasses of Node.
  2. It is almost over. Basically what's left is checkstrformat.py and stats.py which should not be hard, and replacing the type of type_map to a be a callable (there should be a name for this type). After that, there will be almost no mention of Node in the code.

No casts are needed, but there are 7 assertions, in places where the calling code assumes to be true anyway (these also need the separation during tests, otherwise they are vacuous). I think these assertions will not be needed if and when there will be ExpressionVisitor and StatementVisitor.

I will not be available for the next two days. Happy new year everybody!

@gvanrossum gvanrossum merged commit d5c5c02 into python:master Oct 3, 2016
@gvanrossum
Copy link
Member

Happy new year!

@elazarg elazarg deleted the tt_treetrans branch October 27, 2016 15:02
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.

2 participants