* @return a compilation unit that can be modified by the reconciler
*/
public CompilationUnit getResolvableCompilationUnit() {
if (parsedUnitState == CacheState.VALID) {
if (parsedUnitAccessed) {
return (CompilationUnit) parsedUnit.accept(new AstCloner());
}
CompilationUnit unit = parsedUnit;
parsedUnitState = CacheState.FLUSHED;
parsedUnitAccessed = false;
parsedUnit = null;
return unit;
}
ResolutionState state = resolutionState;
while (state != null) {
if (state.builtUnitState == CacheState.VALID) {
// TODO(brianwilkerson) We're cloning the structure to remove any previous resolution data,
// but I'm not sure that's necessary.
return (CompilationUnit) state.builtUnit.accept(new AstCloner());
}
if (state.resolvedUnitState == CacheState.VALID) {
return (CompilationUnit) state.resolvedUnit.accept(new AstCloner());
}
state = state.nextState;
};
return null;
}