minor codegen refactoring
* cleanup after yesterday * remove BindingContext stack in GenerationState * use more power and strength of di TODO: also initialize GenerationState by DI
This commit is contained in:
@@ -20,23 +20,34 @@ import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.lang.resolve.FqName;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class ClassFileFactory {
|
||||
private final ClassBuilderFactory builderFactory;
|
||||
private ClassBuilderFactory builderFactory;
|
||||
public GenerationState state;
|
||||
|
||||
|
||||
private final Map<FqName, NamespaceCodegen> ns2codegen = new HashMap<FqName, NamespaceCodegen>();
|
||||
private final Map<String, ClassBuilder> generators = new LinkedHashMap<String, ClassBuilder>();
|
||||
private boolean isDone = false;
|
||||
public final GenerationState state;
|
||||
|
||||
public ClassFileFactory(ClassBuilderFactory builderFactory, GenerationState state) {
|
||||
|
||||
@Inject
|
||||
public void setBuilderFactory(ClassBuilderFactory builderFactory) {
|
||||
this.builderFactory = builderFactory;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setState(GenerationState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ClassBuilder newVisitor(String filePath) {
|
||||
state.getProgress().log("Emitting: " + filePath);
|
||||
final ClassBuilder answer = builderFactory.newClassBuilder();
|
||||
|
||||
@@ -24,11 +24,8 @@ import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethods;
|
||||
import org.jetbrains.jet.di.InjectorForJvmCodegen;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils;
|
||||
@@ -36,58 +33,50 @@ import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetObjectDeclaration;
|
||||
import org.jetbrains.jet.lang.psi.JetObjectLiteralExpression;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzeExhaust;
|
||||
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;
|
||||
|
||||
public class GenerationState {
|
||||
@NotNull
|
||||
private final ClassFileFactory factory;
|
||||
private final Project project;
|
||||
|
||||
private final Stack<BindingContext> bindingContexts = new Stack<BindingContext>();
|
||||
private final Progress progress;
|
||||
@NotNull
|
||||
private final AnalyzeExhaust analyzeExhaust;
|
||||
@NotNull
|
||||
private final List<JetFile> files;
|
||||
@NotNull
|
||||
private final InjectorForJvmCodegen injector;
|
||||
|
||||
|
||||
// initialized after analyze
|
||||
private InjectorForJvmCodegen injector;
|
||||
|
||||
|
||||
public GenerationState(Project project, ClassBuilderFactory builderFactory) {
|
||||
this(project, builderFactory, Progress.DEAF);
|
||||
public GenerationState(Project project, ClassBuilderFactory builderFactory, AnalyzeExhaust analyzeExhaust, List<JetFile> files) {
|
||||
this(project, builderFactory, Progress.DEAF, analyzeExhaust, files);
|
||||
}
|
||||
|
||||
public GenerationState(Project project, ClassBuilderFactory builderFactory, Progress progress) {
|
||||
public GenerationState(Project project, ClassBuilderFactory builderFactory, Progress progress, @NotNull AnalyzeExhaust exhaust, @NotNull List<JetFile> files) {
|
||||
this.project = project;
|
||||
this.progress = progress;
|
||||
this.factory = new ClassFileFactory(builderFactory, this);
|
||||
this.analyzeExhaust = exhaust;
|
||||
this.files = files;
|
||||
this.injector = new InjectorForJvmCodegen(analyzeExhaust.getStandardLibrary(), analyzeExhaust.getBindingContext(), this.files, project, this, builderFactory);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassFileFactory getFactory() {
|
||||
return factory;
|
||||
return getInjector().getClassFileFactory();
|
||||
}
|
||||
|
||||
public Progress getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public InjectorForJvmCodegen getInjector() {
|
||||
return injector;
|
||||
}
|
||||
|
||||
public BindingContext getBindingContext() {
|
||||
return bindingContexts.peek();
|
||||
return analyzeExhaust.getBindingContext();
|
||||
}
|
||||
|
||||
public ClassCodegen forClass() {
|
||||
@@ -95,73 +84,42 @@ public class GenerationState {
|
||||
}
|
||||
|
||||
public ClassBuilder forClassImplementation(ClassDescriptor aClass) {
|
||||
return factory.newVisitor(injector.getJetTypeMapper().mapType(aClass.getDefaultType(), OwnerKind.IMPLEMENTATION).getInternalName() + ".class");
|
||||
return getFactory().newVisitor(getInjector().getJetTypeMapper().mapType(aClass.getDefaultType(), OwnerKind.IMPLEMENTATION).getInternalName() + ".class");
|
||||
}
|
||||
|
||||
public ClassBuilder forTraitImplementation(ClassDescriptor aClass) {
|
||||
return factory.newVisitor(injector.getJetTypeMapper().mapType(aClass.getDefaultType(), OwnerKind.TRAIT_IMPL).getInternalName() + ".class");
|
||||
return getFactory().newVisitor(getInjector().getJetTypeMapper().mapType(aClass.getDefaultType(), OwnerKind.TRAIT_IMPL).getInternalName() + ".class");
|
||||
}
|
||||
|
||||
public Pair<String, ClassBuilder> forAnonymousSubclass(JetExpression expression) {
|
||||
String className = injector.getJetTypeMapper().getClosureAnnotator().classNameForAnonymousClass(expression);
|
||||
return Pair.create(className, factory.forAnonymousSubclass(className));
|
||||
String className = getInjector().getJetTypeMapper().getClosureAnnotator().classNameForAnonymousClass(expression);
|
||||
return Pair.create(className, getFactory().forAnonymousSubclass(className));
|
||||
}
|
||||
|
||||
public NamespaceCodegen forNamespace(JetFile namespace) {
|
||||
return factory.forNamespace(namespace);
|
||||
return getFactory().forNamespace(namespace);
|
||||
}
|
||||
|
||||
public BindingContext compile(JetFile file) {
|
||||
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(file, JetControlFlowDataTraceFactory.EMPTY);
|
||||
|
||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||
compileCorrectFiles(analyzeExhaust, Collections.singletonList(file), CompilationErrorHandler.THROW_EXCEPTION, true);
|
||||
return analyzeExhaust.getBindingContext();
|
||||
// NamespaceCodegen codegen = forNamespace(namespace);
|
||||
// bindingContexts.push(bindingContext);
|
||||
// typeMapper = new JetTypeMapper(standardLibrary, bindingContext);
|
||||
// try {
|
||||
// AnalyzingUtils.throwExceptionOnErrors(bindingContext);
|
||||
//
|
||||
// codegen.generate(namespace);
|
||||
// }
|
||||
// finally {
|
||||
// bindingContexts.pop();
|
||||
// typeMapper = null;
|
||||
// }
|
||||
}
|
||||
|
||||
public void compileCorrectFiles(AnalyzeExhaust bindingContext, List<JetFile> files, boolean annotate) {
|
||||
compileCorrectFiles(bindingContext, files, CompilationErrorHandler.THROW_EXCEPTION, annotate);
|
||||
}
|
||||
|
||||
public void compileCorrectFiles(AnalyzeExhaust analyzeExhaust, List<JetFile> files, @NotNull CompilationErrorHandler errorHandler, boolean annotate) {
|
||||
injector = new InjectorForJvmCodegen(analyzeExhaust.getStandardLibrary(), analyzeExhaust.getBindingContext(), files, project);
|
||||
bindingContexts.push(analyzeExhaust.getBindingContext());
|
||||
try {
|
||||
for (JetFile file : files) {
|
||||
if (file == null) throw new IllegalArgumentException("A null file given for compilation");
|
||||
VirtualFile vFile = file.getVirtualFile();
|
||||
String path = vFile != null ? vFile.getPath() : "no_virtual_file/" + file.getName();
|
||||
progress.log("For source: " + path);
|
||||
try {
|
||||
generateNamespace(file);
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
errorHandler.reportException(e, vFile == null ? "no file" : vFile.getUrl());
|
||||
DiagnosticUtils.throwIfRunningOnServer(e);
|
||||
if (ApplicationManager.getApplication().isInternal()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
public void compileCorrectFiles(@NotNull CompilationErrorHandler errorHandler) {
|
||||
for (JetFile file : this.files) {
|
||||
if (file == null) throw new IllegalArgumentException("A null file given for compilation");
|
||||
VirtualFile vFile = file.getVirtualFile();
|
||||
String path = vFile != null ? vFile.getPath() : "no_virtual_file/" + file.getName();
|
||||
progress.log("For source: " + path);
|
||||
try {
|
||||
generateNamespace(file);
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
errorHandler.reportException(e, vFile == null ? "no file" : vFile.getUrl());
|
||||
DiagnosticUtils.throwIfRunningOnServer(e);
|
||||
if (ApplicationManager.getApplication().isInternal()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
bindingContexts.pop();
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateNamespace(JetFile namespace) {
|
||||
@@ -175,11 +133,12 @@ public class GenerationState {
|
||||
|
||||
closure.cv = nameAndVisitor.getSecond();
|
||||
closure.name = nameAndVisitor.getFirst();
|
||||
final CodegenContext objectContext = closure.context.intoAnonymousClass(closure, getBindingContext().get(BindingContext.CLASS, objectDeclaration), OwnerKind.IMPLEMENTATION, injector.getJetTypeMapper());
|
||||
final CodegenContext objectContext = closure.context.intoAnonymousClass(
|
||||
closure, analyzeExhaust.getBindingContext().get(BindingContext.CLASS, objectDeclaration), OwnerKind.IMPLEMENTATION, injector.getJetTypeMapper());
|
||||
|
||||
new ImplementationBodyCodegen(objectDeclaration, objectContext, nameAndVisitor.getSecond(), this).generate();
|
||||
|
||||
ConstructorDescriptor constructorDescriptor = closure.state.getBindingContext().get(BindingContext.CONSTRUCTOR, objectDeclaration);
|
||||
ConstructorDescriptor constructorDescriptor = analyzeExhaust.getBindingContext().get(BindingContext.CONSTRUCTOR, objectDeclaration);
|
||||
CallableMethod callableMethod = injector.getJetTypeMapper().mapToCallableMethod(
|
||||
constructorDescriptor, OwnerKind.IMPLEMENTATION, injector.getJetTypeMapper().hasThis0(constructorDescriptor.getContainingDeclaration()));
|
||||
return new GeneratedAnonymousClassDescriptor(nameAndVisitor.first, callableMethod.getSignature().getAsmMethod(), objectContext.outerWasUsed, null);
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.jetbrains.jet.di;
|
||||
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import java.util.List;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.codegen.JetTypeMapper;
|
||||
import org.jetbrains.jet.codegen.ClosureAnnotator;
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import java.util.List;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/* This file is generated by org.jetbrains.jet.di.AllInjectorsGenerator. DO NOT EDIT! */
|
||||
public class InjectorForJetTypeMapper {
|
||||
|
||||
private JetTypeMapper jetTypeMapper;
|
||||
|
||||
public InjectorForJetTypeMapper(
|
||||
@NotNull JetStandardLibrary jetStandardLibrary,
|
||||
@NotNull BindingContext bindingContext,
|
||||
@NotNull List<JetFile> listOfJetFile
|
||||
) {
|
||||
this.jetTypeMapper = new JetTypeMapper();
|
||||
ClosureAnnotator closureAnnotator = new ClosureAnnotator();
|
||||
|
||||
this.jetTypeMapper.setBindingContext(bindingContext);
|
||||
this.jetTypeMapper.setClosureAnnotator(closureAnnotator);
|
||||
this.jetTypeMapper.setStandardLibrary(jetStandardLibrary);
|
||||
|
||||
closureAnnotator.setBindingContext(bindingContext);
|
||||
closureAnnotator.setFiles(listOfJetFile);
|
||||
|
||||
jetTypeMapper.init();
|
||||
|
||||
closureAnnotator.init();
|
||||
|
||||
}
|
||||
|
||||
public JetTypeMapper getJetTypeMapper() {
|
||||
return this.jetTypeMapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,32 +22,43 @@ 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.GenerationState;
|
||||
import org.jetbrains.jet.codegen.ClassBuilderFactory;
|
||||
import org.jetbrains.jet.codegen.JetTypeMapper;
|
||||
import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethods;
|
||||
import org.jetbrains.jet.codegen.ClassFileFactory;
|
||||
import org.jetbrains.jet.codegen.ClosureAnnotator;
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
|
||||
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.GenerationState;
|
||||
import org.jetbrains.jet.codegen.ClassBuilderFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/* This file is generated by org.jetbrains.jet.di.AllInjectorsGenerator. DO NOT EDIT! */
|
||||
public class InjectorForJvmCodegen {
|
||||
|
||||
private final JetStandardLibrary jetStandardLibrary;
|
||||
private final GenerationState generationState;
|
||||
private JetTypeMapper jetTypeMapper;
|
||||
private IntrinsicMethods intrinsics;
|
||||
private ClassFileFactory classFileFactory;
|
||||
|
||||
public InjectorForJvmCodegen(
|
||||
@NotNull JetStandardLibrary jetStandardLibrary,
|
||||
@NotNull BindingContext bindingContext,
|
||||
@NotNull List<JetFile> listOfJetFile,
|
||||
@NotNull Project project
|
||||
@NotNull Project project,
|
||||
@NotNull GenerationState generationState,
|
||||
@NotNull ClassBuilderFactory classBuilderFactory
|
||||
) {
|
||||
this.jetStandardLibrary = jetStandardLibrary;
|
||||
this.generationState = generationState;
|
||||
this.jetTypeMapper = new JetTypeMapper();
|
||||
this.intrinsics = new IntrinsicMethods();
|
||||
this.classFileFactory = new ClassFileFactory();
|
||||
ClosureAnnotator closureAnnotator = new ClosureAnnotator();
|
||||
|
||||
this.jetTypeMapper.setBindingContext(bindingContext);
|
||||
@@ -57,6 +68,9 @@ public class InjectorForJvmCodegen {
|
||||
this.intrinsics.setMyProject(project);
|
||||
this.intrinsics.setMyStdLib(jetStandardLibrary);
|
||||
|
||||
this.classFileFactory.setBuilderFactory(classBuilderFactory);
|
||||
this.classFileFactory.setState(generationState);
|
||||
|
||||
closureAnnotator.setBindingContext(bindingContext);
|
||||
closureAnnotator.setFiles(listOfJetFile);
|
||||
|
||||
@@ -72,6 +86,10 @@ public class InjectorForJvmCodegen {
|
||||
return this.jetStandardLibrary;
|
||||
}
|
||||
|
||||
public GenerationState getGenerationState() {
|
||||
return this.generationState;
|
||||
}
|
||||
|
||||
public JetTypeMapper getJetTypeMapper() {
|
||||
return this.jetTypeMapper;
|
||||
}
|
||||
@@ -80,4 +98,8 @@ public class InjectorForJvmCodegen {
|
||||
return this.intrinsics;
|
||||
}
|
||||
|
||||
public ClassFileFactory getClassFileFactory() {
|
||||
return this.classFileFactory;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ public class CompileEnvironment {
|
||||
if (!scriptCompileSession.analyze()) {
|
||||
return null;
|
||||
}
|
||||
ClassFileFactory factory = scriptCompileSession.generate(true);
|
||||
ClassFileFactory factory = scriptCompileSession.generate(true).getFactory();
|
||||
|
||||
return runDefineModules(moduleFile, factory);
|
||||
}
|
||||
@@ -295,7 +295,7 @@ public class CompileEnvironment {
|
||||
if (!moduleCompileSession.analyze() && !ignoreErrors) {
|
||||
return null;
|
||||
}
|
||||
return moduleCompileSession.generate(false);
|
||||
return moduleCompileSession.generate(false).getFactory();
|
||||
}
|
||||
|
||||
public static void writeToJar(ClassFileFactory factory, final OutputStream fos, @Nullable FqName mainClass, boolean includeRuntime) {
|
||||
@@ -383,7 +383,7 @@ public class CompileEnvironment {
|
||||
return null;
|
||||
}
|
||||
|
||||
ClassFileFactory factory = session.generate(false);
|
||||
ClassFileFactory factory = session.generate(false).getFactory();
|
||||
return new GeneratedClassLoader(factory);
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ public class CompileEnvironment {
|
||||
return false;
|
||||
}
|
||||
|
||||
ClassFileFactory factory = session.generate(false);
|
||||
ClassFileFactory factory = session.generate(false).getFactory();
|
||||
if (jar != null) {
|
||||
try {
|
||||
writeToJar(factory, new FileOutputStream(jar), mainClass, includeRuntime);
|
||||
|
||||
@@ -212,11 +212,11 @@ public class CompileSession {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassFileFactory generate(boolean module) {
|
||||
public GenerationState generate(boolean module) {
|
||||
Project project = environment.getProject();
|
||||
GenerationState generationState = new GenerationState(project, ClassBuilderFactories.binaries(stubs), isVerbose ? new BackendProgress() : Progress.DEAF);
|
||||
generationState.compileCorrectFiles(bindingContext, sourceFiles, CompilationErrorHandler.THROW_EXCEPTION, true);
|
||||
ClassFileFactory answer = generationState.getFactory();
|
||||
GenerationState generationState = new GenerationState(project, ClassBuilderFactories.binaries(stubs),
|
||||
isVerbose ? new BackendProgress() : Progress.DEAF, bindingContext, sourceFiles);
|
||||
generationState.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
|
||||
List<CompilerPlugin> plugins = environment.getCompilerPlugins();
|
||||
if (!module) {
|
||||
@@ -227,7 +227,7 @@ public class CompileSession {
|
||||
}
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
return generationState;
|
||||
}
|
||||
|
||||
private class BackendProgress implements Progress {
|
||||
|
||||
@@ -47,7 +47,6 @@ import org.jetbrains.jet.codegen.CompilationErrorHandler;
|
||||
import org.jetbrains.jet.codegen.GenerationState;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
@@ -156,7 +155,12 @@ public class JetLightClass extends AbstractLightClass implements JetJavaMirrorMa
|
||||
}
|
||||
};
|
||||
|
||||
final GenerationState state = new GenerationState(project, builderFactory) {
|
||||
// The context must reflect _all files in the module_. not only the current file
|
||||
// Otherwise, the analyzer gets confused and can't, for example, tell which files come as sources and which
|
||||
// must be loaded from .class files
|
||||
AnalyzeExhaust context = AnalyzerFacadeForJVM.shallowAnalyzeFiles(WholeProjectAnalyzerFacade.WHOLE_PROJECT_DECLARATION_PROVIDER.fun(file));
|
||||
|
||||
final GenerationState state = new GenerationState(project, builderFactory, context, Collections.singletonList(file)) {
|
||||
@Override
|
||||
protected void generateNamespace(JetFile namespace) {
|
||||
PsiManager manager = PsiManager.getInstance(project);
|
||||
@@ -187,12 +191,7 @@ public class JetLightClass extends AbstractLightClass implements JetJavaMirrorMa
|
||||
};
|
||||
|
||||
|
||||
// The context must reflect _all files in the module_. not only the current file
|
||||
// Otherwise, the analyzer gets confused and can't, for example, tell which files come as sources and which
|
||||
// must be loaded from .class files
|
||||
AnalyzeExhaust context = AnalyzerFacadeForJVM.shallowAnalyzeFiles(WholeProjectAnalyzerFacade.WHOLE_PROJECT_DECLARATION_PROVIDER.fun(file));
|
||||
|
||||
state.compileCorrectFiles(context, Collections.singletonList(file), CompilationErrorHandler.THROW_EXCEPTION, true);
|
||||
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
state.getFactory().files();
|
||||
|
||||
return answer;
|
||||
|
||||
@@ -19,15 +19,19 @@ package org.jetbrains.jet.codegen;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.JetLiteFixture;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.parsing.JetParsingTest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -116,9 +120,12 @@ public abstract class CodegenTestCase extends JetLiteFixture {
|
||||
}
|
||||
|
||||
protected String generateToText() {
|
||||
GenerationState state = new GenerationState(getProject(), ClassBuilderFactories.TEXT);
|
||||
AnalyzingUtils.checkForSyntacticErrors(myFile);
|
||||
state.compile(myFile);
|
||||
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(myFile, JetControlFlowDataTraceFactory.EMPTY);
|
||||
GenerationState state = new GenerationState(getProject(), ClassBuilderFactories.TEXT, analyzeExhaust, Collections.singletonList(myFile));
|
||||
|
||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
|
||||
return state.createText();
|
||||
}
|
||||
@@ -159,9 +166,13 @@ public abstract class CodegenTestCase extends JetLiteFixture {
|
||||
@NotNull
|
||||
protected ClassFileFactory generateClassesInFile() {
|
||||
try {
|
||||
GenerationState state = new GenerationState(getProject(), ClassBuilderFactories.binaries(false));
|
||||
AnalyzingUtils.checkForSyntacticErrors(myFile);
|
||||
state.compile(myFile);
|
||||
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(myFile, JetControlFlowDataTraceFactory.EMPTY);
|
||||
GenerationState state = new GenerationState(getProject(), ClassBuilderFactories.binaries(false), analyzeExhaust, Collections.singletonList(myFile));
|
||||
|
||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
analyzeExhaust.getBindingContext();
|
||||
|
||||
return state.getFactory();
|
||||
} catch (RuntimeException e) {
|
||||
|
||||
@@ -90,19 +90,15 @@ public class TestlibTest extends CodegenTestCase {
|
||||
throw new RuntimeException("There were compilation errors");
|
||||
}
|
||||
|
||||
ClassFileFactory classFileFactory = session.generate(false);
|
||||
GenerationState state = session.generate(false);
|
||||
ClassFileFactory classFileFactory = state.getFactory();
|
||||
|
||||
final GeneratedClassLoader loader = new GeneratedClassLoader(
|
||||
classFileFactory,
|
||||
new URLClassLoader(new URL[]{ForTestCompileStdlib.stdlibJarForTests().toURI().toURL(), junitJar.toURI().toURL()},
|
||||
TestCase.class.getClassLoader()));
|
||||
|
||||
InjectorForJvmCodegen injector = new InjectorForJvmCodegen(
|
||||
session.getBindingContext().getStandardLibrary(),
|
||||
session.getBindingContext().getBindingContext(),
|
||||
session.getSourceFileNamespaces(),
|
||||
getProject());
|
||||
JetTypeMapper typeMapper = injector.getJetTypeMapper();
|
||||
JetTypeMapper typeMapper = state.getInjector().getJetTypeMapper();
|
||||
TestSuite suite = new TestSuite("stdlib_test");
|
||||
try {
|
||||
for(JetFile jetFile : session.getSourceFileNamespaces()) {
|
||||
|
||||
@@ -28,9 +28,13 @@ import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.codegen.ClassBuilderFactories;
|
||||
import org.jetbrains.jet.codegen.ClassFileFactory;
|
||||
import org.jetbrains.jet.codegen.CompilationErrorHandler;
|
||||
import org.jetbrains.jet.codegen.GenerationState;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
import org.junit.Assert;
|
||||
|
||||
@@ -78,9 +82,13 @@ public class CompileJavaAgainstKotlinTest extends TestCaseWithTmpdir {
|
||||
virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET);
|
||||
JetFile psiFile = (JetFile) ((PsiFileFactoryImpl) PsiFileFactory.getInstance(jetCoreEnvironment.getProject())).trySetupPsiForFile(virtualFile, JetLanguage.INSTANCE, true, false);
|
||||
|
||||
GenerationState state = new GenerationState(jetCoreEnvironment.getProject(), ClassBuilderFactories.binaries(false));
|
||||
AnalyzingUtils.checkForSyntacticErrors(psiFile);
|
||||
state.compile(psiFile);
|
||||
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile, JetControlFlowDataTraceFactory.EMPTY);
|
||||
GenerationState state = new GenerationState(jetCoreEnvironment.getProject(), ClassBuilderFactories.binaries(false), analyzeExhaust, Collections.singletonList(psiFile));
|
||||
|
||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
analyzeExhaust.getBindingContext();
|
||||
|
||||
ClassFileFactory classFileFactory = state.getFactory();
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@ import junit.framework.Test;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.codegen.ClassBuilderFactories;
|
||||
import org.jetbrains.jet.codegen.ClassBuilderFactory;
|
||||
import org.jetbrains.jet.codegen.ClassFileFactory;
|
||||
import org.jetbrains.jet.codegen.GenerationState;
|
||||
import org.jetbrains.jet.codegen.*;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
|
||||
import java.io.File;
|
||||
@@ -41,6 +41,7 @@ import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
@@ -93,10 +94,14 @@ public class CompileKotlinAgainstKotlinTest extends TestCaseWithTmpdir {
|
||||
virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET);
|
||||
JetFile psiFile = (JetFile) ((PsiFileFactoryImpl) PsiFileFactory.getInstance(jetCoreEnvironment.getProject())).trySetupPsiForFile(virtualFile, JetLanguage.INSTANCE, true, false);
|
||||
|
||||
GenerationState state = new GenerationState(jetCoreEnvironment.getProject(), ClassBuilderFactories.binaries(false));
|
||||
AnalyzingUtils.checkForSyntacticErrors(psiFile);
|
||||
|
||||
state.compile(psiFile);
|
||||
|
||||
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile, JetControlFlowDataTraceFactory.EMPTY);
|
||||
GenerationState state = new GenerationState(jetCoreEnvironment.getProject(), ClassBuilderFactories.binaries(false), analyzeExhaust, Collections.singletonList(psiFile));
|
||||
|
||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
analyzeExhaust.getBindingContext();
|
||||
|
||||
ClassFileFactory classFileFactory = state.getFactory();
|
||||
|
||||
@@ -116,9 +121,13 @@ public class CompileKotlinAgainstKotlinTest extends TestCaseWithTmpdir {
|
||||
virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET);
|
||||
JetFile psiFile = (JetFile) ((PsiFileFactoryImpl) PsiFileFactory.getInstance(jetCoreEnvironment.getProject())).trySetupPsiForFile(virtualFile, JetLanguage.INSTANCE, true, false);
|
||||
|
||||
GenerationState state = new GenerationState(jetCoreEnvironment.getProject(), ClassBuilderFactories.binaries(false));
|
||||
AnalyzingUtils.checkForSyntacticErrors(psiFile);
|
||||
state.compile(psiFile);
|
||||
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile, JetControlFlowDataTraceFactory.EMPTY);
|
||||
GenerationState state = new GenerationState(jetCoreEnvironment.getProject(), ClassBuilderFactories.binaries(false), analyzeExhaust, Collections.singletonList(psiFile));
|
||||
|
||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
analyzeExhaust.getBindingContext();
|
||||
|
||||
ClassFileFactory classFileFactory = state.getFactory();
|
||||
|
||||
|
||||
@@ -28,19 +28,24 @@ import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.codegen.ClassBuilderFactories;
|
||||
import org.jetbrains.jet.codegen.ClassFileFactory;
|
||||
import org.jetbrains.jet.codegen.CompilationErrorHandler;
|
||||
import org.jetbrains.jet.codegen.GenerationState;
|
||||
import org.jetbrains.jet.di.InjectorForJavaSemanticServices;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.lang.resolve.java.DescriptorSearchRule;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Compile Kotlin and then parse model from .class files.
|
||||
@@ -70,9 +75,13 @@ public class ReadKotlinBinaryClassTest extends TestCaseWithTmpdir {
|
||||
virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET);
|
||||
JetFile psiFile = (JetFile) ((PsiFileFactoryImpl) PsiFileFactory.getInstance(jetCoreEnvironment.getProject())).trySetupPsiForFile(virtualFile, JetLanguage.INSTANCE, true, false);
|
||||
|
||||
GenerationState state = new GenerationState(jetCoreEnvironment.getProject(), ClassBuilderFactories.binaries(false));
|
||||
AnalyzingUtils.checkForSyntacticErrors(psiFile);
|
||||
BindingContext bindingContext = state.compile(psiFile);
|
||||
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile, JetControlFlowDataTraceFactory.EMPTY);
|
||||
GenerationState state = new GenerationState(jetCoreEnvironment.getProject(), ClassBuilderFactories.binaries(false), analyzeExhaust, Collections.singletonList(psiFile));
|
||||
|
||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
BindingContext bindingContext = analyzeExhaust.getBindingContext();
|
||||
|
||||
ClassFileFactory classFileFactory = state.getFactory();
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.codegen.ClassBuilderFactories;
|
||||
import org.jetbrains.jet.codegen.ClassBuilderFactory;
|
||||
import org.jetbrains.jet.codegen.ClassFileFactory;
|
||||
import org.jetbrains.jet.codegen.GenerationState;
|
||||
import org.jetbrains.jet.codegen.*;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
import org.junit.Assert;
|
||||
@@ -48,6 +48,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -84,9 +85,14 @@ public class WriteSignatureTest extends TestCaseWithTmpdir {
|
||||
virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET);
|
||||
JetFile psiFile = (JetFile) ((PsiFileFactoryImpl) PsiFileFactory.getInstance(jetCoreEnvironment.getProject())).trySetupPsiForFile(virtualFile, JetLanguage.INSTANCE, true, false);
|
||||
|
||||
GenerationState state = new GenerationState(jetCoreEnvironment.getProject(), ClassBuilderFactories.binaries(false));
|
||||
AnalyzingUtils.checkForSyntacticErrors(psiFile);
|
||||
state.compile(psiFile);
|
||||
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(psiFile, JetControlFlowDataTraceFactory.EMPTY);
|
||||
GenerationState state = new GenerationState(jetCoreEnvironment.getProject(), ClassBuilderFactories.binaries(false),
|
||||
analyzeExhaust, Collections.singletonList(psiFile));
|
||||
|
||||
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
|
||||
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
analyzeExhaust.getBindingContext();
|
||||
|
||||
ClassFileFactory classFileFactory = state.getFactory();
|
||||
|
||||
|
||||
@@ -37,9 +37,11 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.codegen.ClosureAnnotator;
|
||||
import org.jetbrains.jet.codegen.JetTypeMapper;
|
||||
import org.jetbrains.jet.codegen.NamespaceCodegen;
|
||||
import org.jetbrains.jet.di.InjectorForJetTypeMapper;
|
||||
import org.jetbrains.jet.di.InjectorForJvmCodegen;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
|
||||
import org.jetbrains.jet.plugin.compiler.WholeProjectAnalyzerFacade;
|
||||
|
||||
@@ -153,11 +155,9 @@ public class JetPositionManager implements PositionManager {
|
||||
if (mapper != null) {
|
||||
return mapper;
|
||||
}
|
||||
final BindingContext bindingContext = WholeProjectAnalyzerFacade.analyzeProjectWithCacheOnAFile(file)
|
||||
.getBindingContext();
|
||||
final JetStandardLibrary standardLibrary = JetStandardLibrary.getInstance();
|
||||
InjectorForJvmCodegen injector = new InjectorForJvmCodegen(standardLibrary, bindingContext, Collections.singletonList(file), file.getProject());
|
||||
final JetTypeMapper typeMapper = injector.getJetTypeMapper();
|
||||
final AnalyzeExhaust analyzeExhaust = WholeProjectAnalyzerFacade.analyzeProjectWithCacheOnAFile(file);
|
||||
JetTypeMapper typeMapper = new InjectorForJetTypeMapper(
|
||||
analyzeExhaust.getStandardLibrary(), analyzeExhaust.getBindingContext(), Collections.singletonList(file)).getJetTypeMapper();
|
||||
myTypeMappers.put(file, typeMapper);
|
||||
return typeMapper;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ import org.jetbrains.jet.codegen.ClassFileFactory;
|
||||
import org.jetbrains.jet.codegen.CompilationErrorHandler;
|
||||
import org.jetbrains.jet.codegen.GenerationState;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzeExhaust;
|
||||
import org.jetbrains.jet.plugin.compiler.WholeProjectAnalyzerFacade;
|
||||
|
||||
@@ -200,11 +199,12 @@ public class BytecodeToolwindow extends JPanel implements Disposable {
|
||||
}
|
||||
|
||||
protected String generateToText(JetFile file) {
|
||||
GenerationState state = new GenerationState(myProject, ClassBuilderFactories.TEXT);
|
||||
GenerationState state;
|
||||
try {
|
||||
AnalyzeExhaust binding = WholeProjectAnalyzerFacade.analyzeProjectWithCacheOnAFile(file);
|
||||
// AnalyzingUtils.throwExceptionOnErrors(binding);
|
||||
state.compileCorrectFiles(binding, Collections.singletonList(file), CompilationErrorHandler.THROW_EXCEPTION, true);
|
||||
state = new GenerationState(myProject, ClassBuilderFactories.TEXT, binding, Collections.singletonList(file));
|
||||
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
}
|
||||
catch (Exception e) {
|
||||
StringWriter out = new StringWriter(1024);
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
package org.jetbrains.jet.di;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.jet.codegen.ClassBuilderFactory;
|
||||
import org.jetbrains.jet.codegen.ClassFileFactory;
|
||||
import org.jetbrains.jet.codegen.GenerationState;
|
||||
import org.jetbrains.jet.codegen.JetTypeMapper;
|
||||
import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethods;
|
||||
import org.jetbrains.jet.lang.ModuleConfiguration;
|
||||
@@ -49,6 +52,7 @@ public class AllInjectorsGenerator {
|
||||
generateTestInjector();
|
||||
generateInjectorForJavaSemanticServices();
|
||||
generateInjectorForJvmCodegen();
|
||||
generateInjectorForJetTypeMapper();
|
||||
}
|
||||
|
||||
private static void generateInjectorForTopDownAnalyzerBasic() throws IOException {
|
||||
@@ -143,9 +147,21 @@ public class AllInjectorsGenerator {
|
||||
generator.addParameter(BindingContext.class);
|
||||
generator.addParameter(DiType.listOf(JetFile.class));
|
||||
generator.addParameter(Project.class);
|
||||
generator.addPublicParameter(GenerationState.class);
|
||||
generator.addParameter(ClassBuilderFactory.class);
|
||||
generator.addPublicField(JetTypeMapper.class);
|
||||
generator.addField(true, IntrinsicMethods.class, "intrinsics", null);
|
||||
generator.addPublicField(ClassFileFactory.class);
|
||||
generator.generate("compiler/backend/src", "org.jetbrains.jet.di", "InjectorForJvmCodegen");
|
||||
}
|
||||
|
||||
private static void generateInjectorForJetTypeMapper() throws IOException {
|
||||
DependencyInjectorGenerator generator = new DependencyInjectorGenerator(false);
|
||||
generator.addParameter(JetStandardLibrary.class);
|
||||
generator.addParameter(BindingContext.class);
|
||||
generator.addParameter(DiType.listOf(JetFile.class));
|
||||
generator.addPublicField(JetTypeMapper.class);
|
||||
generator.generate("compiler/backend/src", "org.jetbrains.jet.di", "InjectorForJetTypeMapper");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user