Progress messages when emitting classfiles
This commit is contained in:
@@ -38,6 +38,7 @@ public class ClassFileFactory {
|
||||
}
|
||||
|
||||
ClassBuilder newVisitor(String filePath) {
|
||||
state.getProgress().log("Emitting: " + filePath);
|
||||
final ClassBuilder answer = builderFactory.newClassBuilder();
|
||||
generators.put(filePath, answer);
|
||||
return answer;
|
||||
|
||||
@@ -31,8 +31,8 @@ import org.jetbrains.jet.lang.psi.JetElement;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Type;
|
||||
@@ -128,7 +128,7 @@ public class ClosureCodegen extends ObjectOrClosureCodegen {
|
||||
funClass,
|
||||
new String[0]
|
||||
);
|
||||
cv.visitSource(state.transformFileName(fun.getContainingFile().getName()), null);
|
||||
cv.visitSource(fun.getContainingFile().getName(), null);
|
||||
|
||||
|
||||
generateBridge(name, funDescriptor, fun, cv);
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
|
||||
import org.jetbrains.jet.utils.Progress;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -51,9 +52,15 @@ public class GenerationState {
|
||||
private final Stack<BindingContext> bindingContexts = new Stack<BindingContext>();
|
||||
private final JetStandardLibrary standardLibrary;
|
||||
private final IntrinsicMethods intrinsics;
|
||||
private final Progress progress;
|
||||
|
||||
public GenerationState(Project project, ClassBuilderFactory builderFactory) {
|
||||
this(project, builderFactory, Progress.DEAF);
|
||||
}
|
||||
|
||||
public GenerationState(Project project, ClassBuilderFactory builderFactory, Progress progress) {
|
||||
this.project = project;
|
||||
this.progress = progress;
|
||||
this.standardLibrary = JetStandardLibrary.getInstance();
|
||||
this.factory = new ClassFileFactory(builderFactory, this);
|
||||
this.intrinsics = new IntrinsicMethods(project, standardLibrary);
|
||||
@@ -64,6 +71,10 @@ public class GenerationState {
|
||||
return factory;
|
||||
}
|
||||
|
||||
public Progress getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
@@ -133,14 +144,15 @@ public class GenerationState {
|
||||
typeMapper = new JetTypeMapper(standardLibrary, bindingContext, closureAnnotator);
|
||||
bindingContexts.push(bindingContext);
|
||||
try {
|
||||
for (JetFile namespace : files) {
|
||||
if (namespace == null) throw new IllegalArgumentException("A null file given for compilation");
|
||||
for (JetFile file : files) {
|
||||
if (file == null) throw new IllegalArgumentException("A null file given for compilation");
|
||||
VirtualFile vFile = file.getVirtualFile();
|
||||
progress.log("For source: " + vFile.getPath());
|
||||
try {
|
||||
generateNamespace(namespace);
|
||||
generateNamespace(file);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
VirtualFile virtualFile = namespace.getContainingFile().getVirtualFile();
|
||||
errorHandler.reportException(e, virtualFile == null ? "no file" : virtualFile.getUrl());
|
||||
errorHandler.reportException(e, vFile == null ? "no file" : vFile.getUrl());
|
||||
DiagnosticUtils.throwIfRunningOnServer(e);
|
||||
if (ApplicationManager.getApplication().isInternal()) {
|
||||
e.printStackTrace();
|
||||
@@ -188,9 +200,4 @@ public class GenerationState {
|
||||
|
||||
return answer.toString();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String transformFileName(@NotNull String fileName) {
|
||||
return fileName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,12 +21,7 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.codegen.signature.BothSignatureWriter;
|
||||
import org.jetbrains.jet.codegen.signature.JvmClassSignature;
|
||||
import org.jetbrains.jet.codegen.signature.JvmMethodParameterKind;
|
||||
import org.jetbrains.jet.codegen.signature.JvmMethodParameterSignature;
|
||||
import org.jetbrains.jet.codegen.signature.JvmMethodSignature;
|
||||
import org.jetbrains.jet.codegen.signature.JvmPropertyAccessorSignature;
|
||||
import org.jetbrains.jet.codegen.signature.*;
|
||||
import org.jetbrains.jet.codegen.signature.kotlin.JetValueParameterAnnotationWriter;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
@@ -115,7 +110,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
signature.getSuperclassName(),
|
||||
signature.getInterfaces().toArray(new String[0])
|
||||
);
|
||||
v.visitSource(state.transformFileName(myClass.getContainingFile().getName()), null);
|
||||
v.visitSource(myClass.getContainingFile().getName(), null);
|
||||
|
||||
ClassDescriptor container = getContainingClassDescriptor(descriptor);
|
||||
if(container != null) {
|
||||
|
||||
@@ -51,7 +51,7 @@ public class NamespaceCodegen {
|
||||
new String[0]
|
||||
);
|
||||
// TODO figure something out for a namespace that spans multiple files
|
||||
v.visitSource(state.transformFileName(sourceFile.getName()), null);
|
||||
v.visitSource(sourceFile.getName(), null);
|
||||
}
|
||||
|
||||
public void generate(JetFile file) {
|
||||
|
||||
@@ -21,8 +21,8 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import java.util.List;
|
||||
@@ -70,7 +70,7 @@ public class TraitImplBodyCodegen extends ClassBodyCodegen {
|
||||
"java/lang/Object",
|
||||
new String[0]
|
||||
);
|
||||
v.visitSource(state.transformFileName(myClass.getContainingFile().getName()), null);
|
||||
v.visitSource(myClass.getContainingFile().getName(), null);
|
||||
}
|
||||
|
||||
private String jvmName() {
|
||||
|
||||
Reference in New Issue
Block a user