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

simplify JDTBatchCompiler.getUnits(). Reuse existing CU #933

Merged

Conversation

pvojtechovsky
Copy link
Collaborator

The compilation is done in two phases.

  1. treeBuilderCompiler.buildUnits()
  2. parser.dietParse() this call is processed for each result of the treeBuilderCompiler.buildUnits() and needs a CompilationUnit with the same name ... it is the same file which was used to produce the unit ... so we can use the CompilationUnit which is directly stored here unit.compilationResult.compilationUnit

I would like to have this change because

  1. it makes code more readable
  2. it makes clear that same compilation unit is used. Before the treeBuilderCompiler.buildUnits() worked with different input files, then parser.dietParse() ... it took me several hours until I recognized that both inputs should be always same.
  3. the parameter files of the method CompilationUnitDeclaration[] getUnits(List<SpoonFile> files) is now unused, so we can remove it in next PR

@monperrus monperrus merged commit 385f127 into INRIA:master Nov 5, 2016
@pvojtechovsky pvojtechovsky deleted the refactorJDTBatchCompiler-getUnits branch November 5, 2016 22:33
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