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

refactor(printerContext): assure correct restore of state #999

Merged
merged 1 commit into from
Nov 23, 2016

Conversation

pvojtechovsky
Copy link
Collaborator

The new PrintingContext assures that boolean states like [noTypeDecl, ignoreGenerics, ...] are always set to origin value.

@monperrus
Copy link
Collaborator

Very nice to use try with resources.

OK for me.

Since we're at the core of Spoon, @tdurieux, what 's your opinion ?

@tdurieux
Copy link
Collaborator

It is nice, but I am not sure if that increases the readability of the class.

@pvojtechovsky
Copy link
Collaborator Author

I agree that readability is worst then

context.flag=true;
...
context.flag=false;

but, my intention was not make it more readable but to make it more reliable. With the new code (if reader understands it) you can be sure that origin state is correctly restored. It was not the case before. There was a place for a mistake ... and may be in some wild class/nested class/lambda/... combination it would even fail actually... nobody know.

@monperrus
Copy link
Collaborator

I agree, there is a trade-off between readability and reliability.

@monperrus monperrus merged commit d458b88 into INRIA:master Nov 23, 2016
@pvojtechovsky pvojtechovsky deleted the consistentPrintingScopes branch November 23, 2016 12:44
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.

3 participants