injector to analyze js
This commit is contained in:
@@ -99,7 +99,6 @@ public class InjectorForTopDownAnalyzerForJvm {
|
||||
JavaTypeTransformer javaTypeTransformer = new JavaTypeTransformer();
|
||||
|
||||
this.topDownAnalyzer.setBodyResolver(bodyResolver);
|
||||
this.topDownAnalyzer.setConfiguration(javaBridgeConfiguration);
|
||||
this.topDownAnalyzer.setContext(topDownAnalysisContext);
|
||||
this.topDownAnalyzer.setControlFlowAnalyzer(controlFlowAnalyzer);
|
||||
this.topDownAnalyzer.setDeclarationResolver(declarationResolver);
|
||||
|
||||
@@ -93,7 +93,6 @@ public class InjectorForTopDownAnalyzerBasic {
|
||||
TypeHierarchyResolver typeHierarchyResolver = new TypeHierarchyResolver();
|
||||
|
||||
this.topDownAnalyzer.setBodyResolver(bodyResolver);
|
||||
this.topDownAnalyzer.setConfiguration(moduleConfiguration);
|
||||
this.topDownAnalyzer.setContext(topDownAnalysisContext);
|
||||
this.topDownAnalyzer.setControlFlowAnalyzer(controlFlowAnalyzer);
|
||||
this.topDownAnalyzer.setDeclarationResolver(declarationResolver);
|
||||
|
||||
@@ -76,27 +76,4 @@ public class AnalyzingUtils {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public static BindingContext analyzeFiles(
|
||||
@NotNull Project project,
|
||||
@NotNull ModuleConfiguration configuration,
|
||||
@NotNull Collection<JetFile> files,
|
||||
@NotNull Predicate<PsiFile> filesToAnalyzeCompletely,
|
||||
@NotNull JetControlFlowDataTraceFactory flowDataTraceFactory) {
|
||||
BindingTraceContext bindingTraceContext = new BindingTraceContext();
|
||||
analyzeFilesWithGivenTrace(project, configuration, files, filesToAnalyzeCompletely, flowDataTraceFactory, bindingTraceContext);
|
||||
return bindingTraceContext.getBindingContext();
|
||||
}
|
||||
|
||||
public static void analyzeFilesWithGivenTrace(
|
||||
@NotNull Project project,
|
||||
@NotNull final ModuleConfiguration configuration,
|
||||
@NotNull Collection<JetFile> files,
|
||||
@NotNull Predicate<PsiFile> filesToAnalyzeCompletely,
|
||||
@NotNull JetControlFlowDataTraceFactory flowDataTraceFactory,
|
||||
@NotNull BindingTraceContext bindingTraceContext) {
|
||||
|
||||
TopDownAnalyzer.doAnalyzeFilesWithGivenTrace(project, configuration, files, filesToAnalyzeCompletely, flowDataTraceFactory, bindingTraceContext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -62,8 +61,6 @@ public class TopDownAnalyzer {
|
||||
@NotNull
|
||||
private BindingTrace trace;
|
||||
@NotNull
|
||||
private ModuleConfiguration configuration;
|
||||
@NotNull
|
||||
private ModuleDescriptor moduleDescriptor;
|
||||
@NotNull
|
||||
private NamespaceFactoryImpl namespaceFactory;
|
||||
@@ -112,11 +109,6 @@ public class TopDownAnalyzer {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setConfiguration(@NotNull ModuleConfiguration configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setModuleDescriptor(@NotNull ModuleDescriptor moduleDescriptor) {
|
||||
this.moduleDescriptor = moduleDescriptor;
|
||||
@@ -143,29 +135,6 @@ public class TopDownAnalyzer {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void process(
|
||||
@NotNull Project project,
|
||||
@NotNull BindingTrace trace,
|
||||
@NotNull JetScope outerScope,
|
||||
@NotNull ModuleDescriptor moduleDescriptor,
|
||||
@NotNull NamespaceLikeBuilder owner,
|
||||
@NotNull Collection<? extends PsiElement> declarations,
|
||||
@NotNull Predicate<PsiFile> analyzeCompletely,
|
||||
@NotNull JetControlFlowDataTraceFactory flowDataTraceFactory,
|
||||
@NotNull ModuleConfiguration configuration,
|
||||
boolean declaredLocally) {
|
||||
|
||||
TopDownAnalysisParameters topDownAnalysisParameters = new TopDownAnalysisParameters(analyzeCompletely, false, declaredLocally);
|
||||
|
||||
InjectorForTopDownAnalyzerBasic injector = new InjectorForTopDownAnalyzerBasic(
|
||||
project, topDownAnalysisParameters, new ObservableBindingTrace(trace), moduleDescriptor, flowDataTraceFactory, configuration);
|
||||
|
||||
injector.getTopDownAnalyzer().doProcess(outerScope, owner, declarations);
|
||||
|
||||
}
|
||||
|
||||
public void doProcess(
|
||||
JetScope outerScope,
|
||||
NamespaceLikeBuilder owner,
|
||||
@@ -242,7 +211,14 @@ public class TopDownAnalyzer {
|
||||
|
||||
ModuleDescriptor moduleDescriptor = new ModuleDescriptor("<dummy for objec>");
|
||||
|
||||
process(project, trace, outerScope, moduleDescriptor, new NamespaceLikeBuilder() {
|
||||
TopDownAnalysisParameters topDownAnalysisParameters =
|
||||
new TopDownAnalysisParameters(Predicates.equalTo(object.getContainingFile()), false, true);
|
||||
|
||||
InjectorForTopDownAnalyzerBasic injector = new InjectorForTopDownAnalyzerBasic(
|
||||
project, topDownAnalysisParameters, new ObservableBindingTrace(trace), moduleDescriptor,
|
||||
JetControlFlowDataTraceFactory.EMPTY, ModuleConfiguration.EMPTY);
|
||||
|
||||
injector.getTopDownAnalyzer().doProcess(outerScope, new NamespaceLikeBuilder() {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -274,23 +250,10 @@ public class TopDownAnalyzer {
|
||||
public ClassObjectStatus setClassObjectDescriptor(@NotNull MutableClassDescriptorLite classObjectDescriptor) {
|
||||
return ClassObjectStatus.NOT_ALLOWED;
|
||||
}
|
||||
}, Collections.<PsiElement>singletonList(object), Predicates.equalTo(object.getContainingFile()), JetControlFlowDataTraceFactory.EMPTY, ModuleConfiguration.EMPTY, true);
|
||||
}, Collections.<PsiElement>singletonList(object));
|
||||
}
|
||||
|
||||
|
||||
public static void doAnalyzeFilesWithGivenTrace(Project project, final ModuleConfiguration configuration, Collection<JetFile> files, Predicate<PsiFile> filesToAnalyzeCompletely, JetControlFlowDataTraceFactory flowDataTraceFactory, BindingTraceContext bindingTraceContext) {
|
||||
final ModuleDescriptor owner = new ModuleDescriptor("<module>");
|
||||
|
||||
TopDownAnalysisParameters topDownAnalysisParameters = new TopDownAnalysisParameters(
|
||||
filesToAnalyzeCompletely, false, false);
|
||||
|
||||
InjectorForTopDownAnalyzerBasic injector = new InjectorForTopDownAnalyzerBasic(
|
||||
project, topDownAnalysisParameters, new ObservableBindingTrace(bindingTraceContext), owner, flowDataTraceFactory, configuration);
|
||||
|
||||
|
||||
injector.getTopDownAnalyzer().doAnalyzeFilesWithGivenTrance2(files);
|
||||
}
|
||||
|
||||
public void doAnalyzeFilesWithGivenTrance2(Collection<JetFile> files) {
|
||||
final WritableScope scope = new WritableScopeImpl(
|
||||
JetScope.EMPTY, moduleDescriptor,
|
||||
|
||||
Reference in New Issue
Block a user