Injector interface used in tests
This commit is contained in:
+3
-3
@@ -23,7 +23,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.di.InjectorForTopDownAnalyzerForJvm;
|
||||
import org.jetbrains.jet.di.InjectorForTopDownAnalyzer;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
@@ -46,13 +46,13 @@ public class AbstractLazyResolveDescriptorRendererTest extends AbstractLazyResol
|
||||
|
||||
protected void doTest(@NotNull String testFile) throws IOException {
|
||||
|
||||
InjectorForTopDownAnalyzerForJvm injectorForTopDownAnalyzer = getEagerInjectorForTopDownAnalyzer();
|
||||
InjectorForTopDownAnalyzer injectorForTopDownAnalyzer = getEagerInjectorForTopDownAnalyzer();
|
||||
|
||||
JetFile psiFile = JetPsiFactory.createFile(project, FileUtil.loadFile(new File(testFile), true));
|
||||
Collection<JetFile> files = Lists.newArrayList(psiFile);
|
||||
|
||||
ModuleDescriptor lazyModule = new ModuleDescriptor(Name.special("<lazy module>"));
|
||||
final ResolveSession resolveSession = new ResolveSession(project, lazyModule, injectorForTopDownAnalyzer.getJavaBridgeConfiguration(),
|
||||
final ResolveSession resolveSession = new ResolveSession(project, lazyModule, injectorForTopDownAnalyzer.getModuleConfiguration(),
|
||||
new FileBasedDeclarationProviderFactory(files));
|
||||
|
||||
final List<DeclarationDescriptor> descriptors = new ArrayList<DeclarationDescriptor>();
|
||||
|
||||
+4
-4
@@ -21,8 +21,8 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.Function;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.di.InjectorForTopDownAnalyzer;
|
||||
import org.jetbrains.jet.jvm.compiler.NamespaceComparator;
|
||||
import org.jetbrains.jet.di.InjectorForTopDownAnalyzerForJvm;
|
||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
@@ -45,7 +45,7 @@ public abstract class AbstractLazyResolveNamespaceComparingTest extends Abstract
|
||||
boolean includeMembersOfObject
|
||||
) throws IOException {
|
||||
ModuleDescriptor module = new ModuleDescriptor(Name.special("<test module>"));
|
||||
InjectorForTopDownAnalyzerForJvm injector = createInjectorForTDA(module);
|
||||
InjectorForTopDownAnalyzer injector = createInjectorForTDA(module);
|
||||
|
||||
List<JetFile> files = JetTestUtils
|
||||
.createTestFiles(testFileName, FileUtil.loadFile(new File(testFileName), true), new JetTestUtils.TestFileFactory<JetFile>() {
|
||||
@@ -55,10 +55,10 @@ public abstract class AbstractLazyResolveNamespaceComparingTest extends Abstract
|
||||
}
|
||||
});
|
||||
|
||||
InjectorForTopDownAnalyzerForJvm tdaInjectorForLazy = getEagerInjectorForTopDownAnalyzer();
|
||||
InjectorForTopDownAnalyzer tdaInjectorForLazy = getEagerInjectorForTopDownAnalyzer();
|
||||
|
||||
ModuleDescriptor lazyModule = new ModuleDescriptor(Name.special("<lazy module>"));
|
||||
ResolveSession session = new ResolveSession(project, lazyModule, tdaInjectorForLazy.getJavaBridgeConfiguration(), new FileBasedDeclarationProviderFactory(files));
|
||||
ResolveSession session = new ResolveSession(project, lazyModule, tdaInjectorForLazy.getModuleConfiguration(), new FileBasedDeclarationProviderFactory(files));
|
||||
|
||||
injector.getTopDownAnalyzer().analyzeFiles(files, Collections.<AnalyzerScriptParameter>emptyList());
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.jet.CompileCompilerDependenciesTest;
|
||||
import org.jetbrains.jet.ConfigurationKind;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.di.InjectorForTopDownAnalyzer;
|
||||
import org.jetbrains.jet.di.InjectorForTopDownAnalyzerForJvm;
|
||||
import org.jetbrains.jet.lang.BuiltinsScopeExtensionMode;
|
||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
||||
@@ -62,17 +63,17 @@ public abstract class AbstractLazyResolveTest {
|
||||
Disposer.dispose(rootDisposable);
|
||||
}
|
||||
|
||||
protected InjectorForTopDownAnalyzerForJvm getEagerInjectorForTopDownAnalyzer() {
|
||||
protected InjectorForTopDownAnalyzer getEagerInjectorForTopDownAnalyzer() {
|
||||
ModuleDescriptor eagerModuleForLazy = new ModuleDescriptor(Name.special("<eager module for lazy>"));
|
||||
|
||||
InjectorForTopDownAnalyzerForJvm tdaInjectorForLazy = createInjectorForTDA(eagerModuleForLazy);
|
||||
InjectorForTopDownAnalyzer tdaInjectorForLazy = createInjectorForTDA(eagerModuleForLazy);
|
||||
// This line is required fro the 'jet' namespace to be filled in with functions
|
||||
tdaInjectorForLazy.getTopDownAnalyzer().analyzeFiles(
|
||||
Collections.singletonList(JetPsiFactory.createFile(project, "")), Collections.<AnalyzerScriptParameter>emptyList());
|
||||
return tdaInjectorForLazy;
|
||||
}
|
||||
|
||||
protected InjectorForTopDownAnalyzerForJvm createInjectorForTDA(ModuleDescriptor module) {
|
||||
protected InjectorForTopDownAnalyzer createInjectorForTDA(ModuleDescriptor module) {
|
||||
TopDownAnalysisParameters params = new TopDownAnalysisParameters(
|
||||
Predicates.<PsiFile>alwaysTrue(), false, false, Collections.<AnalyzerScriptParameter>emptyList());
|
||||
return new InjectorForTopDownAnalyzerForJvm(project, params, new BindingTraceContext(), module, BuiltinsScopeExtensionMode.ALL);
|
||||
|
||||
Reference in New Issue
Block a user