merge copy-paste after excessive inline in e6fda5

This commit is contained in:
Stepan Koltsov
2012-03-29 23:38:46 +04:00
parent 060be0a8f8
commit ec367a0bf0
8 changed files with 74 additions and 92 deletions
@@ -120,14 +120,14 @@ public abstract class CodegenTestCase extends JetLiteFixture {
}
protected String generateToText() {
AnalyzingUtils.checkForSyntacticErrors(myFile);
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(myFile, JetControlFlowDataTraceFactory.EMPTY);
GenerationState state = new GenerationState(getProject(), ClassBuilderFactories.TEXT, analyzeExhaust, Collections.singletonList(myFile));
return generateCommon(ClassBuilderFactories.TEXT).createText();
}
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
private GenerationState generateCommon(ClassBuilderFactory classBuilderFactory) {
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegrationAndCheckForErrors(myFile, JetControlFlowDataTraceFactory.EMPTY);
GenerationState state = new GenerationState(getProject(), classBuilderFactory, analyzeExhaust, Collections.singletonList(myFile));
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
return state.createText();
return state;
}
protected Class generateNamespaceClass() {
@@ -166,15 +166,9 @@ public abstract class CodegenTestCase extends JetLiteFixture {
@NotNull
protected ClassFileFactory generateClassesInFile() {
try {
AnalyzingUtils.checkForSyntacticErrors(myFile);
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(myFile, JetControlFlowDataTraceFactory.EMPTY);
GenerationState state = new GenerationState(getProject(), ClassBuilderFactories.binaries(false), analyzeExhaust, Collections.singletonList(myFile));
ClassBuilderFactory classBuilderFactory = ClassBuilderFactories.binaries(false);
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
analyzeExhaust.getBindingContext();
return state.getFactory();
return generateCommon(classBuilderFactory).getFactory();
} catch (RuntimeException e) {
System.out.println(generateToText());
throw e;