Fixed redundant done invocation on asByteArray call

This commit is contained in:
Mikhael Bogdanov
2014-01-15 15:28:54 +04:00
parent ea44d15058
commit 353d1c488b
2 changed files with 5 additions and 3 deletions
@@ -71,7 +71,7 @@ public final class ClassFileFactory extends GenerationStateAware implements Outp
return answer;
}
private void done() {
void done() {
if (!isDone) {
isDone = true;
for (PackageCodegen codegen : package2codegen.values()) {
@@ -199,15 +199,15 @@ public final class ClassFileFactory extends GenerationStateAware implements Outp
);
}
@NotNull
@Override
public byte[] asByteArray() {
done();
return builderFactory.asBytes(generators.get(relativeClassFilePath).classBuilder);
}
@NotNull
@Override
public String asText() {
done();
return builderFactory.asText(generators.get(relativeClassFilePath).classBuilder);
}
}
@@ -56,6 +56,8 @@ public class KotlinCodegenFacade {
for (Map.Entry<FqName, Collection<JetFile>> entry : packageFqNameToFiles.entrySet()) {
generatePackage(state, entry.getKey(), entry.getValue(), errorHandler);
}
state.getFactory().done();
}
public static void generatePackage(