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

[feat] Use original source for methods and fields #97

Merged
merged 8 commits into from
Apr 9, 2020

Conversation

slarse
Copy link
Collaborator

@slarse slarse commented Apr 9, 2020

Fix #95

This PR is a bit of a monster, so I'll squash it. I just don't have time to make it pretty.

The major feature of this PR is that the PcsInterpreter has been changed to keep track of which revisions appear in which subtrees. If a subtree is found to contain only a single revision, then the interpreter sets metadata on the node to indicate that.

When the pretty printer finds such metadata on a method or field node, it does not attempt to print it but instead extracts the original source code and prints that, all the while attempting to match indentation. It seems like it works.

Checking pretty print vs reparsed pretty print in tests no longer works as a result of this, however.

The ContentMerger has also been refactored not to have any side effects, which was necessary to make this all work. The source code extraction functionality of the pretty printer has been moved to a separate class.

@slarse
Copy link
Collaborator Author

slarse commented Apr 9, 2020

CI failed because of a bug in the benchmark script, the PR is fine.

@slarse slarse merged commit 4d5ffb6 into master Apr 9, 2020
@slarse slarse deleted the issue/95-use-original-source-for-methods branch April 10, 2020 12:31
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.

Use original source code when an entire method has not been altered
1 participant