Removed unused myProject field from IntrinsicMethods. Removed from injector parameters, etc.
This commit is contained in:
@@ -19,10 +19,10 @@
|
||||
*/
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.asm4.commons.Method;
|
||||
import org.jetbrains.jet.analyzer.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.di.InjectorForJvmCodegen;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
@@ -30,11 +30,10 @@ import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.ScriptNameUtil;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.utils.Progress;
|
||||
import org.jetbrains.asm4.commons.Method;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -42,7 +41,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GenerationState {
|
||||
private final Project project;
|
||||
private final Progress progress;
|
||||
@NotNull
|
||||
private final AnalyzeExhaust analyzeExhaust;
|
||||
@@ -60,20 +58,19 @@ public class GenerationState {
|
||||
private Method scriptConstructorMethod;
|
||||
|
||||
|
||||
public GenerationState(Project project, ClassBuilderFactory builderFactory, AnalyzeExhaust analyzeExhaust, List<JetFile> files) {
|
||||
this(project, builderFactory, Progress.DEAF, analyzeExhaust, files, BuiltinToJavaTypesMapping.ENABLED);
|
||||
public GenerationState(ClassBuilderFactory builderFactory, AnalyzeExhaust analyzeExhaust, List<JetFile> files) {
|
||||
this(builderFactory, Progress.DEAF, analyzeExhaust, files, BuiltinToJavaTypesMapping.ENABLED);
|
||||
}
|
||||
|
||||
public GenerationState(Project project, ClassBuilderFactory builderFactory, Progress progress,
|
||||
public GenerationState(ClassBuilderFactory builderFactory, Progress progress,
|
||||
@NotNull AnalyzeExhaust exhaust, @NotNull List<JetFile> files, @NotNull BuiltinToJavaTypesMapping builtinToJavaTypesMapping) {
|
||||
this.project = project;
|
||||
this.progress = progress;
|
||||
this.analyzeExhaust = exhaust;
|
||||
this.files = files;
|
||||
this.classBuilderMode = builderFactory.getClassBuilderMode();
|
||||
this.injector = new InjectorForJvmCodegen(
|
||||
analyzeExhaust.getBindingContext(),
|
||||
this.files, project, builtinToJavaTypesMapping, builderFactory.getClassBuilderMode(), this, builderFactory);
|
||||
this.files, builtinToJavaTypesMapping, builderFactory.getClassBuilderMode(), this, builderFactory);
|
||||
}
|
||||
|
||||
private void markUsed() {
|
||||
|
||||
@@ -65,17 +65,11 @@ public class IntrinsicMethods {
|
||||
public static final String KOTLIN_ARRAYS_ARRAY = "kotlin.arrays.array";
|
||||
public static final String KOTLIN_JAVA_CLASS_PROPERTY = "kotlin.javaClass.property";
|
||||
|
||||
private Project myProject;
|
||||
private final Map<String, IntrinsicMethod> namedMethods = new HashMap<String, IntrinsicMethod>();
|
||||
private static final IntrinsicMethod ARRAY_ITERATOR = new ArrayIterator();
|
||||
private final IntrinsicsMap intrinsicsMap = new IntrinsicsMap();
|
||||
|
||||
|
||||
@Inject
|
||||
public void setMyProject(Project myProject) {
|
||||
this.myProject = myProject;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
namedMethods.put(KOTLIN_JAVA_CLASS_FUNCTION, new JavaClassFunction());
|
||||
|
||||
@@ -20,7 +20,6 @@ package org.jetbrains.jet.di;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import java.util.List;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.jet.codegen.BuiltinToJavaTypesMapping;
|
||||
import org.jetbrains.jet.codegen.ClassBuilderMode;
|
||||
import org.jetbrains.jet.codegen.GenerationState;
|
||||
@@ -40,7 +39,6 @@ public class InjectorForJvmCodegen {
|
||||
|
||||
private final BindingContext bindingContext;
|
||||
private final List<JetFile> listOfJetFile;
|
||||
private final Project project;
|
||||
private final BuiltinToJavaTypesMapping builtinToJavaTypesMapping;
|
||||
private final ClassBuilderMode classBuilderMode;
|
||||
private final GenerationState generationState;
|
||||
@@ -56,7 +54,6 @@ public class InjectorForJvmCodegen {
|
||||
public InjectorForJvmCodegen(
|
||||
@NotNull BindingContext bindingContext,
|
||||
@NotNull List<JetFile> listOfJetFile,
|
||||
@NotNull Project project,
|
||||
@NotNull BuiltinToJavaTypesMapping builtinToJavaTypesMapping,
|
||||
@NotNull ClassBuilderMode classBuilderMode,
|
||||
@NotNull GenerationState generationState,
|
||||
@@ -64,7 +61,6 @@ public class InjectorForJvmCodegen {
|
||||
) {
|
||||
this.bindingContext = bindingContext;
|
||||
this.listOfJetFile = listOfJetFile;
|
||||
this.project = project;
|
||||
this.builtinToJavaTypesMapping = builtinToJavaTypesMapping;
|
||||
this.classBuilderMode = classBuilderMode;
|
||||
this.generationState = generationState;
|
||||
@@ -92,8 +88,6 @@ public class InjectorForJvmCodegen {
|
||||
this.scriptCodegen.setMemberCodegen(memberCodegen);
|
||||
this.scriptCodegen.setState(generationState);
|
||||
|
||||
this.intrinsics.setMyProject(project);
|
||||
|
||||
this.classFileFactory.setBuilderFactory(classBuilderFactory);
|
||||
this.classFileFactory.setState(generationState);
|
||||
|
||||
|
||||
+1
-1
@@ -339,7 +339,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
environment.getConfiguration().get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY).report(CompilerMessageSeverity.LOGGING, message, CompilerMessageLocation.NO_LOCATION);
|
||||
}
|
||||
};
|
||||
GenerationState generationState = new GenerationState(project, ClassBuilderFactories.binaries(stubs), backendProgress,
|
||||
GenerationState generationState = new GenerationState(ClassBuilderFactories.binaries(stubs), backendProgress,
|
||||
exhaust, environment.getSourceFiles(),
|
||||
environment.getConfiguration().get(
|
||||
JVMConfigurationKeys.BUILTIN_TO_JAVA_TYPES_MAPPING_KEY,
|
||||
|
||||
@@ -236,7 +236,7 @@ public class ReplInterpreter {
|
||||
earierScripts.add(Pair.create(earlierLine.getScriptDescriptor(), earlierLine.getClassName()));
|
||||
}
|
||||
|
||||
GenerationState generationState = new GenerationState(jetCoreEnvironment.getProject(), ClassBuilderFactories.binaries(false), backendProgress,
|
||||
GenerationState generationState = new GenerationState(ClassBuilderFactories.binaries(false), backendProgress,
|
||||
AnalyzeExhaust.success(trace.getBindingContext()), Collections.singletonList(psiFile),
|
||||
BuiltinToJavaTypesMapping.ENABLED);
|
||||
generationState.compileScript(psiFile.getScript(), scriptClassName, earierScripts, CompilationErrorHandler.THROW_EXCEPTION);
|
||||
|
||||
@@ -180,7 +180,7 @@ public class JetLightClass extends AbstractLightClass implements JetJavaMirrorMa
|
||||
throw new IllegalStateException("failed to analyze: " + context.getError(), context.getError());
|
||||
}
|
||||
|
||||
final GenerationState state = new GenerationState(project, builderFactory, context, Collections.singletonList(file)) {
|
||||
final GenerationState state = new GenerationState(builderFactory, context, Collections.singletonList(file)) {
|
||||
@Override
|
||||
protected void generateNamespace(FqName fqName, Collection<JetFile> namespaceFiles, CompilationErrorHandler errorHandler, Progress progress) {
|
||||
PsiManager manager = PsiManager.getInstance(project);
|
||||
|
||||
@@ -274,7 +274,7 @@ public abstract class CodegenTestCase extends UsefulTestCase {
|
||||
BuiltinsScopeExtensionMode.ALL);
|
||||
analyzeExhaust.throwIfError();
|
||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||
alreadyGenerated = new GenerationState(myEnvironment.getProject(), classBuilderFactory, analyzeExhaust, myFiles.getPsiFiles());
|
||||
alreadyGenerated = new GenerationState(classBuilderFactory, analyzeExhaust, myFiles.getPsiFiles());
|
||||
alreadyGenerated.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
return alreadyGenerated;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class GenerationUtils {
|
||||
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegrationAndCheckForErrors(
|
||||
psiFile, Collections.<AnalyzerScriptParameter>emptyList(), BuiltinsScopeExtensionMode.ALL);
|
||||
analyzeExhaust.throwIfError();
|
||||
GenerationState state = new GenerationState(psiFile.getProject(), ClassBuilderFactories.binaries(false), analyzeExhaust, Collections.singletonList(psiFile));
|
||||
GenerationState state = new GenerationState(ClassBuilderFactories.binaries(false), analyzeExhaust, Collections.singletonList(psiFile));
|
||||
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ public class BytecodeToolwindow extends JPanel implements Disposable {
|
||||
if (binding.isError()) {
|
||||
return printStackTraceToString(binding.getError());
|
||||
}
|
||||
state = new GenerationState(myProject, ClassBuilderFactories.TEXT, binding, Collections.singletonList(file));
|
||||
state = new GenerationState(ClassBuilderFactories.TEXT, binding, Collections.singletonList(file));
|
||||
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -189,7 +189,6 @@ public class AllInjectorsGenerator {
|
||||
DependencyInjectorGenerator generator = new DependencyInjectorGenerator(false);
|
||||
generator.addParameter(BindingContext.class);
|
||||
generator.addParameter(DiType.listOf(JetFile.class));
|
||||
generator.addParameter(Project.class);
|
||||
generator.addParameter(BuiltinToJavaTypesMapping.class);
|
||||
generator.addParameter(ClassBuilderMode.class);
|
||||
generator.addPublicParameter(GenerationState.class);
|
||||
|
||||
Reference in New Issue
Block a user