public InjectorForTopDownAnalyzerForJs(
      @NotNull Project project,
      @NotNull TopDownAnalysisParameters topDownAnalysisParameters,
      @NotNull BindingTrace bindingTrace,
      @NotNull ModuleDescriptorImpl moduleDescriptor) {
    this.topDownAnalyzer = new TopDownAnalyzer();
    this.topDownAnalysisContext = new TopDownAnalysisContext();
    this.bodyResolver = new BodyResolver();
    this.controlFlowAnalyzer = new ControlFlowAnalyzer();
    this.declarationsChecker = new DeclarationsChecker();
    this.descriptorResolver = new DescriptorResolver();
    this.callResolverExtensionProvider = new CallResolverExtensionProvider();
    this.project = project;
    this.topDownAnalysisParameters = topDownAnalysisParameters;
    this.bindingTrace = bindingTrace;
    this.moduleDescriptor = moduleDescriptor;
    this.dependencyClassByQualifiedNameResolverDummy =
        new DependencyClassByQualifiedNameResolverDummyImpl();
    this.namespaceFactory = new NamespaceFactoryImpl();
    this.platformToKotlinClassMap = org.jetbrains.jet.lang.PlatformToKotlinClassMap.EMPTY;
    this.declarationResolver = new DeclarationResolver();
    this.annotationResolver = new AnnotationResolver();
    this.callResolver = new CallResolver();
    this.argumentTypeResolver = new ArgumentTypeResolver();
    this.expressionTypingServices = new ExpressionTypingServices();
    this.callExpressionResolver = new CallExpressionResolver();
    this.typeResolver = new TypeResolver();
    this.qualifiedExpressionResolver = new QualifiedExpressionResolver();
    this.candidateResolver = new CandidateResolver();
    this.importsResolver = new ImportsResolver();
    this.jetImportsFactory = new JetImportsFactory();
    this.scriptHeaderResolver = new ScriptHeaderResolver();
    this.overloadResolver = new OverloadResolver();
    this.overrideResolver = new OverrideResolver();
    this.typeHierarchyResolver = new TypeHierarchyResolver();
    this.delegatedPropertyResolver = new DelegatedPropertyResolver();
    this.functionAnalyzerExtension = new FunctionAnalyzerExtension();
    this.scriptBodyResolver = new ScriptBodyResolver();

    this.topDownAnalyzer.setBodyResolver(bodyResolver);
    this.topDownAnalyzer.setContext(topDownAnalysisContext);
    this.topDownAnalyzer.setDeclarationResolver(declarationResolver);
    this.topDownAnalyzer.setModuleDescriptor(moduleDescriptor);
    this.topDownAnalyzer.setNamespaceFactory(namespaceFactory);
    this.topDownAnalyzer.setOverloadResolver(overloadResolver);
    this.topDownAnalyzer.setOverrideResolver(overrideResolver);
    this.topDownAnalyzer.setTopDownAnalysisParameters(topDownAnalysisParameters);
    this.topDownAnalyzer.setTrace(bindingTrace);
    this.topDownAnalyzer.setTypeHierarchyResolver(typeHierarchyResolver);

    this.topDownAnalysisContext.setTopDownAnalysisParameters(topDownAnalysisParameters);

    this.bodyResolver.setAnnotationResolver(annotationResolver);
    this.bodyResolver.setCallResolver(callResolver);
    this.bodyResolver.setContext(topDownAnalysisContext);
    this.bodyResolver.setControlFlowAnalyzer(controlFlowAnalyzer);
    this.bodyResolver.setDeclarationsChecker(declarationsChecker);
    this.bodyResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
    this.bodyResolver.setExpressionTypingServices(expressionTypingServices);
    this.bodyResolver.setFunctionAnalyzerExtension(functionAnalyzerExtension);
    this.bodyResolver.setScriptBodyResolverResolver(scriptBodyResolver);
    this.bodyResolver.setTopDownAnalysisParameters(topDownAnalysisParameters);
    this.bodyResolver.setTrace(bindingTrace);

    this.controlFlowAnalyzer.setTopDownAnalysisParameters(topDownAnalysisParameters);
    this.controlFlowAnalyzer.setTrace(bindingTrace);

    this.declarationsChecker.setTrace(bindingTrace);

    this.descriptorResolver.setAnnotationResolver(annotationResolver);
    this.descriptorResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
    this.descriptorResolver.setExpressionTypingServices(expressionTypingServices);
    this.descriptorResolver.setTypeResolver(typeResolver);

    namespaceFactory.setModuleDescriptor(moduleDescriptor);
    namespaceFactory.setTrace(bindingTrace);

    declarationResolver.setAnnotationResolver(annotationResolver);
    declarationResolver.setContext(topDownAnalysisContext);
    declarationResolver.setDescriptorResolver(descriptorResolver);
    declarationResolver.setImportsResolver(importsResolver);
    declarationResolver.setScriptHeaderResolver(scriptHeaderResolver);
    declarationResolver.setTrace(bindingTrace);

    annotationResolver.setCallResolver(callResolver);
    annotationResolver.setExpressionTypingServices(expressionTypingServices);

    callResolver.setArgumentTypeResolver(argumentTypeResolver);
    callResolver.setCandidateResolver(candidateResolver);
    callResolver.setExpressionTypingServices(expressionTypingServices);
    callResolver.setTypeResolver(typeResolver);

    argumentTypeResolver.setExpressionTypingServices(expressionTypingServices);
    argumentTypeResolver.setTypeResolver(typeResolver);

    expressionTypingServices.setAnnotationResolver(annotationResolver);
    expressionTypingServices.setCallExpressionResolver(callExpressionResolver);
    expressionTypingServices.setCallResolver(callResolver);
    expressionTypingServices.setDescriptorResolver(descriptorResolver);
    expressionTypingServices.setExtensionProvider(callResolverExtensionProvider);
    expressionTypingServices.setPlatformToKotlinClassMap(platformToKotlinClassMap);
    expressionTypingServices.setProject(project);
    expressionTypingServices.setTypeResolver(typeResolver);

    callExpressionResolver.setExpressionTypingServices(expressionTypingServices);

    typeResolver.setAnnotationResolver(annotationResolver);
    typeResolver.setModuleDescriptor(moduleDescriptor);
    typeResolver.setQualifiedExpressionResolver(qualifiedExpressionResolver);

    candidateResolver.setArgumentTypeResolver(argumentTypeResolver);

    importsResolver.setContext(topDownAnalysisContext);
    importsResolver.setImportsFactory(jetImportsFactory);
    importsResolver.setModuleDescriptor(moduleDescriptor);
    importsResolver.setQualifiedExpressionResolver(qualifiedExpressionResolver);
    importsResolver.setTrace(bindingTrace);

    jetImportsFactory.setProject(project);

    scriptHeaderResolver.setContext(topDownAnalysisContext);
    scriptHeaderResolver.setDependencyClassByQualifiedNameResolver(
        dependencyClassByQualifiedNameResolverDummy);
    scriptHeaderResolver.setNamespaceFactory(namespaceFactory);
    scriptHeaderResolver.setTopDownAnalysisParameters(topDownAnalysisParameters);
    scriptHeaderResolver.setTrace(bindingTrace);

    overloadResolver.setContext(topDownAnalysisContext);
    overloadResolver.setTrace(bindingTrace);

    overrideResolver.setContext(topDownAnalysisContext);
    overrideResolver.setTopDownAnalysisParameters(topDownAnalysisParameters);
    overrideResolver.setTrace(bindingTrace);

    typeHierarchyResolver.setContext(topDownAnalysisContext);
    typeHierarchyResolver.setDescriptorResolver(descriptorResolver);
    typeHierarchyResolver.setImportsResolver(importsResolver);
    typeHierarchyResolver.setNamespaceFactory(namespaceFactory);
    typeHierarchyResolver.setScriptHeaderResolver(scriptHeaderResolver);
    typeHierarchyResolver.setTrace(bindingTrace);

    delegatedPropertyResolver.setExpressionTypingServices(expressionTypingServices);

    functionAnalyzerExtension.setTrace(bindingTrace);

    scriptBodyResolver.setContext(topDownAnalysisContext);
    scriptBodyResolver.setExpressionTypingServices(expressionTypingServices);
    scriptBodyResolver.setTrace(bindingTrace);
  }
示例#2
0
  public InjectorForTests(@NotNull Project project, @NotNull ModuleDescriptor moduleDescriptor) {
    this.project = project;
    this.moduleDescriptor = moduleDescriptor;
    this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
    this.descriptorResolver = new DescriptorResolver();
    this.expressionTypingComponents = new ExpressionTypingComponents();
    this.expressionTypingServices = new ExpressionTypingServices(expressionTypingComponents);
    this.callResolver = new CallResolver();
    this.expressionTypingUtils =
        new ExpressionTypingUtils(getExpressionTypingServices(), callResolver);
    this.typeResolver = new TypeResolver();
    this.globalContext = org.jetbrains.jet.context.ContextPackage.GlobalContext();
    this.storageManager = globalContext.getStorageManager();
    this.annotationResolver = new AnnotationResolver();
    this.argumentTypeResolver = new ArgumentTypeResolver();
    this.candidateResolver = new CandidateResolver();
    this.delegatedPropertyResolver = new DelegatedPropertyResolver();
    this.controlStructureTypingUtils =
        new ControlStructureTypingUtils(getExpressionTypingServices());
    this.forLoopConventionsChecker = new ForLoopConventionsChecker();
    this.reflectionTypes = new ReflectionTypes(moduleDescriptor);
    this.callExpressionResolver = new CallExpressionResolver();
    this.callResolverExtensionProvider = new CallResolverExtensionProvider();
    this.qualifiedExpressionResolver = new QualifiedExpressionResolver();

    this.descriptorResolver.setAnnotationResolver(annotationResolver);
    this.descriptorResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
    this.descriptorResolver.setExpressionTypingServices(expressionTypingServices);
    this.descriptorResolver.setStorageManager(storageManager);
    this.descriptorResolver.setTypeResolver(typeResolver);

    this.expressionTypingServices.setAnnotationResolver(annotationResolver);
    this.expressionTypingServices.setCallExpressionResolver(callExpressionResolver);
    this.expressionTypingServices.setCallResolver(callResolver);
    this.expressionTypingServices.setDescriptorResolver(descriptorResolver);
    this.expressionTypingServices.setExtensionProvider(callResolverExtensionProvider);
    this.expressionTypingServices.setProject(project);
    this.expressionTypingServices.setTypeResolver(typeResolver);

    this.typeResolver.setAnnotationResolver(annotationResolver);
    this.typeResolver.setModuleDescriptor(moduleDescriptor);
    this.typeResolver.setQualifiedExpressionResolver(qualifiedExpressionResolver);

    annotationResolver.setCallResolver(callResolver);
    annotationResolver.setStorageManager(storageManager);
    annotationResolver.setTypeResolver(typeResolver);

    callResolver.setArgumentTypeResolver(argumentTypeResolver);
    callResolver.setCandidateResolver(candidateResolver);
    callResolver.setExpressionTypingServices(expressionTypingServices);
    callResolver.setTypeResolver(typeResolver);

    argumentTypeResolver.setExpressionTypingServices(expressionTypingServices);
    argumentTypeResolver.setTypeResolver(typeResolver);

    candidateResolver.setArgumentTypeResolver(argumentTypeResolver);

    delegatedPropertyResolver.setCallResolver(callResolver);
    delegatedPropertyResolver.setExpressionTypingServices(expressionTypingServices);

    expressionTypingComponents.setCallResolver(callResolver);
    expressionTypingComponents.setControlStructureTypingUtils(controlStructureTypingUtils);
    expressionTypingComponents.setExpressionTypingServices(expressionTypingServices);
    expressionTypingComponents.setExpressionTypingUtils(expressionTypingUtils);
    expressionTypingComponents.setForLoopConventionsChecker(forLoopConventionsChecker);
    expressionTypingComponents.setGlobalContext(globalContext);
    expressionTypingComponents.setPlatformToKotlinClassMap(platformToKotlinClassMap);
    expressionTypingComponents.setReflectionTypes(reflectionTypes);

    forLoopConventionsChecker.setExpressionTypingServices(expressionTypingServices);
    forLoopConventionsChecker.setExpressionTypingUtils(expressionTypingUtils);
    forLoopConventionsChecker.setProject(project);

    callExpressionResolver.setExpressionTypingServices(expressionTypingServices);
  }
  public EclipseInjectorForTopDownAnalyzerForJvm(
      @NotNull Project project,
      @NotNull GlobalContext globalContext,
      @NotNull BindingTrace bindingTrace,
      @NotNull ModuleDescriptor moduleDescriptor,
      @NotNull IJavaProject IJavaProject) {
    this.project = project;
    this.globalContext = globalContext;
    this.storageManager = globalContext.getStorageManager();
    this.bindingTrace = bindingTrace;
    this.moduleDescriptor = moduleDescriptor;
    this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
    this.IJavaProject = IJavaProject;
    this.topDownAnalyzer = new TopDownAnalyzer();
    this.lazyTopDownAnalyzer = new LazyTopDownAnalyzer();
    this.mutablePackageFragmentProvider = new MutablePackageFragmentProvider(getModuleDescriptor());
    this.eclipseJavaClassFinder = new EclipseJavaClassFinder();
    this.virtualFileFinder =
        org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinder.SERVICE.getInstance(project);
    this.deserializedDescriptorResolver = new DeserializedDescriptorResolver();
    this.eclipseExternalAnnotationResolver = new EclipseExternalAnnotationResolver();
    this.traceBasedExternalSignatureResolver = new TraceBasedExternalSignatureResolver();
    this.traceBasedErrorReporter = new TraceBasedErrorReporter();
    this.eclipseMethodSignatureChecker = new EclipseMethodSignatureChecker();
    this.eclipseTraceBasedJavaResolverCache = new EclipseTraceBasedJavaResolverCache();
    this.eclipseJavaPropertyInitializerEvaluator = new EclipseJavaPropertyInitializerEvaluator();
    this.eclipseJavaSourceElementFactory = new EclipseJavaSourceElementFactory();
    this.singleModuleClassResolver = new SingleModuleClassResolver();
    this.globalJavaResolverContext =
        new GlobalJavaResolverContext(
            storageManager,
            eclipseJavaClassFinder,
            virtualFileFinder,
            deserializedDescriptorResolver,
            eclipseExternalAnnotationResolver,
            traceBasedExternalSignatureResolver,
            traceBasedErrorReporter,
            eclipseMethodSignatureChecker,
            eclipseTraceBasedJavaResolverCache,
            eclipseJavaPropertyInitializerEvaluator,
            eclipseJavaSourceElementFactory,
            singleModuleClassResolver);
    this.lazyJavaPackageFragmentProvider =
        new LazyJavaPackageFragmentProvider(globalJavaResolverContext, getModuleDescriptor());
    this.javaDescriptorResolver =
        new JavaDescriptorResolver(lazyJavaPackageFragmentProvider, getModuleDescriptor());
    this.javaClassDataFinder =
        new JavaClassDataFinder(virtualFileFinder, deserializedDescriptorResolver);
    this.annotationDescriptorLoader = new AnnotationDescriptorLoader();
    this.constantDescriptorLoader = new ConstantDescriptorLoader();
    this.deserializationGlobalContextForJava =
        new DeserializationGlobalContextForJava(
            storageManager,
            getModuleDescriptor(),
            javaClassDataFinder,
            annotationDescriptorLoader,
            constantDescriptorLoader,
            lazyJavaPackageFragmentProvider);
    this.additionalCheckerProvider =
        org.jetbrains.jet.lang.resolve.kotlin.JavaDeclarationCheckerProvider.INSTANCE$;
    this.bodyResolver = new BodyResolver();
    this.annotationResolver = new AnnotationResolver();
    this.callResolver = new CallResolver();
    this.argumentTypeResolver = new ArgumentTypeResolver();
    this.expressionTypingComponents = new ExpressionTypingComponents();
    this.expressionTypingServices = new ExpressionTypingServices(expressionTypingComponents);
    this.controlStructureTypingUtils = new ControlStructureTypingUtils(expressionTypingServices);
    this.expressionTypingUtils = new ExpressionTypingUtils(expressionTypingServices, callResolver);
    this.forLoopConventionsChecker = new ForLoopConventionsChecker();
    this.reflectionTypes = new ReflectionTypes(getModuleDescriptor());
    this.callExpressionResolver = new CallExpressionResolver();
    this.descriptorResolver = new DescriptorResolver();
    this.delegatedPropertyResolver = new DelegatedPropertyResolver();
    this.typeResolver = new TypeResolver();
    this.qualifiedExpressionResolver = new QualifiedExpressionResolver();
    this.callResolverExtensionProvider = new CallResolverExtensionProvider();
    this.candidateResolver = new CandidateResolver();
    this.callCompleter = new CallCompleter(argumentTypeResolver, candidateResolver);
    this.controlFlowAnalyzer = new ControlFlowAnalyzer();
    this.declarationsChecker = new DeclarationsChecker();
    this.functionAnalyzerExtension = new FunctionAnalyzerExtension();
    this.scriptBodyResolver = new ScriptBodyResolver();
    this.declarationResolver = new DeclarationResolver();
    this.importsResolver = new ImportsResolver();
    this.jetImportsFactory = new JetImportsFactory();
    this.overloadResolver = new OverloadResolver();
    this.overrideResolver = new OverrideResolver();
    this.typeHierarchyResolver = new TypeHierarchyResolver();
    this.scriptHeaderResolver = new ScriptHeaderResolver();
    this.descriptorLoadersStorage = new DescriptorLoadersStorage(storageManager);

    this.topDownAnalyzer.setAdditionalCheckerProvider(additionalCheckerProvider);
    this.topDownAnalyzer.setBodyResolver(bodyResolver);
    this.topDownAnalyzer.setDeclarationResolver(declarationResolver);
    this.topDownAnalyzer.setLazyTopDownAnalyzer(lazyTopDownAnalyzer);
    this.topDownAnalyzer.setModuleDescriptor(moduleDescriptor);
    this.topDownAnalyzer.setOverloadResolver(overloadResolver);
    this.topDownAnalyzer.setOverrideResolver(overrideResolver);
    this.topDownAnalyzer.setPackageFragmentProvider(mutablePackageFragmentProvider);
    this.topDownAnalyzer.setProject(project);
    this.topDownAnalyzer.setTrace(bindingTrace);
    this.topDownAnalyzer.setTypeHierarchyResolver(typeHierarchyResolver);

    this.lazyTopDownAnalyzer.setBodyResolver(bodyResolver);
    this.lazyTopDownAnalyzer.setDeclarationResolver(declarationResolver);
    this.lazyTopDownAnalyzer.setModuleDescriptor(moduleDescriptor);
    this.lazyTopDownAnalyzer.setOverloadResolver(overloadResolver);
    this.lazyTopDownAnalyzer.setOverrideResolver(overrideResolver);
    this.lazyTopDownAnalyzer.setTrace(bindingTrace);

    eclipseJavaClassFinder.setProjectScope(IJavaProject);

    traceBasedExternalSignatureResolver.setExternalAnnotationResolver(
        eclipseExternalAnnotationResolver);
    traceBasedExternalSignatureResolver.setProject(project);
    traceBasedExternalSignatureResolver.setTrace(bindingTrace);

    eclipseTraceBasedJavaResolverCache.setTrace(bindingTrace);

    traceBasedErrorReporter.setTrace(bindingTrace);

    singleModuleClassResolver.setResolver(javaDescriptorResolver);

    bodyResolver.setAnnotationResolver(annotationResolver);
    bodyResolver.setCallResolver(callResolver);
    bodyResolver.setControlFlowAnalyzer(controlFlowAnalyzer);
    bodyResolver.setDeclarationsChecker(declarationsChecker);
    bodyResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
    bodyResolver.setExpressionTypingServices(expressionTypingServices);
    bodyResolver.setFunctionAnalyzerExtension(functionAnalyzerExtension);
    bodyResolver.setScriptBodyResolverResolver(scriptBodyResolver);
    bodyResolver.setTrace(bindingTrace);

    annotationResolver.setCallResolver(callResolver);
    annotationResolver.setStorageManager(storageManager);
    annotationResolver.setTypeResolver(typeResolver);

    callResolver.setArgumentTypeResolver(argumentTypeResolver);
    callResolver.setCallCompleter(callCompleter);
    callResolver.setCandidateResolver(candidateResolver);
    callResolver.setExpressionTypingServices(expressionTypingServices);
    callResolver.setTypeResolver(typeResolver);

    argumentTypeResolver.setExpressionTypingServices(expressionTypingServices);
    argumentTypeResolver.setTypeResolver(typeResolver);

    expressionTypingServices.setAnnotationResolver(annotationResolver);
    expressionTypingServices.setCallExpressionResolver(callExpressionResolver);
    expressionTypingServices.setCallResolver(callResolver);
    expressionTypingServices.setDescriptorResolver(descriptorResolver);
    expressionTypingServices.setExtensionProvider(callResolverExtensionProvider);
    expressionTypingServices.setProject(project);
    expressionTypingServices.setTypeResolver(typeResolver);

    expressionTypingComponents.setAdditionalCheckerProvider(additionalCheckerProvider);
    expressionTypingComponents.setCallResolver(callResolver);
    expressionTypingComponents.setControlStructureTypingUtils(controlStructureTypingUtils);
    expressionTypingComponents.setExpressionTypingServices(expressionTypingServices);
    expressionTypingComponents.setExpressionTypingUtils(expressionTypingUtils);
    expressionTypingComponents.setForLoopConventionsChecker(forLoopConventionsChecker);
    expressionTypingComponents.setGlobalContext(globalContext);
    expressionTypingComponents.setPlatformToKotlinClassMap(platformToKotlinClassMap);
    expressionTypingComponents.setReflectionTypes(reflectionTypes);

    forLoopConventionsChecker.setExpressionTypingServices(expressionTypingServices);
    forLoopConventionsChecker.setExpressionTypingUtils(expressionTypingUtils);
    forLoopConventionsChecker.setProject(project);

    callExpressionResolver.setExpressionTypingServices(expressionTypingServices);

    descriptorResolver.setAnnotationResolver(annotationResolver);
    descriptorResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
    descriptorResolver.setExpressionTypingServices(expressionTypingServices);
    descriptorResolver.setStorageManager(storageManager);
    descriptorResolver.setTypeResolver(typeResolver);

    delegatedPropertyResolver.setCallResolver(callResolver);
    delegatedPropertyResolver.setExpressionTypingServices(expressionTypingServices);

    typeResolver.setAnnotationResolver(annotationResolver);
    typeResolver.setModuleDescriptor(moduleDescriptor);
    typeResolver.setQualifiedExpressionResolver(qualifiedExpressionResolver);

    candidateResolver.setArgumentTypeResolver(argumentTypeResolver);

    controlFlowAnalyzer.setTrace(bindingTrace);

    declarationsChecker.setAdditionalCheckerProvider(additionalCheckerProvider);
    declarationsChecker.setDescriptorResolver(descriptorResolver);
    declarationsChecker.setTrace(bindingTrace);

    functionAnalyzerExtension.setTrace(bindingTrace);

    scriptBodyResolver.setExpressionTypingServices(expressionTypingServices);

    declarationResolver.setAnnotationResolver(annotationResolver);
    declarationResolver.setDescriptorResolver(descriptorResolver);
    declarationResolver.setImportsResolver(importsResolver);
    declarationResolver.setTrace(bindingTrace);

    importsResolver.setImportsFactory(jetImportsFactory);
    importsResolver.setModuleDescriptor(moduleDescriptor);
    importsResolver.setQualifiedExpressionResolver(qualifiedExpressionResolver);
    importsResolver.setTrace(bindingTrace);

    jetImportsFactory.setProject(project);

    overloadResolver.setTrace(bindingTrace);

    overrideResolver.setTrace(bindingTrace);

    typeHierarchyResolver.setDescriptorResolver(descriptorResolver);
    typeHierarchyResolver.setImportsResolver(importsResolver);
    typeHierarchyResolver.setPackageFragmentProvider(mutablePackageFragmentProvider);
    typeHierarchyResolver.setScriptHeaderResolver(scriptHeaderResolver);
    typeHierarchyResolver.setTrace(bindingTrace);

    scriptHeaderResolver.setPackageFragmentProvider(mutablePackageFragmentProvider);
    scriptHeaderResolver.setTrace(bindingTrace);

    deserializedDescriptorResolver.setContext(deserializationGlobalContextForJava);
    deserializedDescriptorResolver.setErrorReporter(traceBasedErrorReporter);

    annotationDescriptorLoader.setErrorReporter(traceBasedErrorReporter);
    annotationDescriptorLoader.setKotlinClassFinder(virtualFileFinder);
    annotationDescriptorLoader.setModule(moduleDescriptor);
    annotationDescriptorLoader.setStorage(descriptorLoadersStorage);

    descriptorLoadersStorage.setErrorReporter(traceBasedErrorReporter);
    descriptorLoadersStorage.setModule(moduleDescriptor);

    constantDescriptorLoader.setErrorReporter(traceBasedErrorReporter);
    constantDescriptorLoader.setKotlinClassFinder(virtualFileFinder);
    constantDescriptorLoader.setStorage(descriptorLoadersStorage);
  }
  public InjectorForBodyResolve(
      @NotNull Project project,
      @NotNull GlobalContext globalContext,
      @NotNull BindingTrace bindingTrace,
      @NotNull ModuleDescriptor moduleDescriptor) {
    this.project = project;
    this.globalContext = globalContext;
    this.storageManager = globalContext.getStorageManager();
    this.bindingTrace = bindingTrace;
    this.moduleDescriptor = moduleDescriptor;
    this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
    this.bodyResolver = new BodyResolver();
    this.annotationResolver = new AnnotationResolver();
    this.callResolver = new CallResolver();
    this.argumentTypeResolver = new ArgumentTypeResolver();
    this.expressionTypingComponents = new ExpressionTypingComponents();
    this.expressionTypingServices = new ExpressionTypingServices(expressionTypingComponents);
    this.controlStructureTypingUtils = new ControlStructureTypingUtils(expressionTypingServices);
    this.expressionTypingUtils = new ExpressionTypingUtils(expressionTypingServices, callResolver);
    this.forLoopConventionsChecker = new ForLoopConventionsChecker();
    this.reflectionTypes = new ReflectionTypes(moduleDescriptor);
    this.callExpressionResolver = new CallExpressionResolver();
    this.descriptorResolver = new DescriptorResolver();
    this.delegatedPropertyResolver = new DelegatedPropertyResolver();
    this.typeResolver = new TypeResolver();
    this.qualifiedExpressionResolver = new QualifiedExpressionResolver();
    this.callResolverExtensionProvider = new CallResolverExtensionProvider();
    this.candidateResolver = new CandidateResolver();
    this.callCompleter = new CallCompleter(argumentTypeResolver, candidateResolver);
    this.controlFlowAnalyzer = new ControlFlowAnalyzer();
    this.declarationsChecker = new DeclarationsChecker();
    this.functionAnalyzerExtension = new FunctionAnalyzerExtension();
    this.scriptBodyResolver = new ScriptBodyResolver();

    this.bodyResolver.setAnnotationResolver(annotationResolver);
    this.bodyResolver.setCallResolver(callResolver);
    this.bodyResolver.setControlFlowAnalyzer(controlFlowAnalyzer);
    this.bodyResolver.setDeclarationsChecker(declarationsChecker);
    this.bodyResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
    this.bodyResolver.setExpressionTypingServices(expressionTypingServices);
    this.bodyResolver.setFunctionAnalyzerExtension(functionAnalyzerExtension);
    this.bodyResolver.setScriptBodyResolverResolver(scriptBodyResolver);
    this.bodyResolver.setTrace(bindingTrace);

    annotationResolver.setCallResolver(callResolver);
    annotationResolver.setStorageManager(storageManager);
    annotationResolver.setTypeResolver(typeResolver);

    callResolver.setArgumentTypeResolver(argumentTypeResolver);
    callResolver.setCallCompleter(callCompleter);
    callResolver.setCandidateResolver(candidateResolver);
    callResolver.setExpressionTypingServices(expressionTypingServices);
    callResolver.setTypeResolver(typeResolver);

    argumentTypeResolver.setExpressionTypingServices(expressionTypingServices);
    argumentTypeResolver.setTypeResolver(typeResolver);

    expressionTypingServices.setAnnotationResolver(annotationResolver);
    expressionTypingServices.setCallExpressionResolver(callExpressionResolver);
    expressionTypingServices.setCallResolver(callResolver);
    expressionTypingServices.setDescriptorResolver(descriptorResolver);
    expressionTypingServices.setExtensionProvider(callResolverExtensionProvider);
    expressionTypingServices.setProject(project);
    expressionTypingServices.setTypeResolver(typeResolver);

    expressionTypingComponents.setCallResolver(callResolver);
    expressionTypingComponents.setControlStructureTypingUtils(controlStructureTypingUtils);
    expressionTypingComponents.setExpressionTypingServices(expressionTypingServices);
    expressionTypingComponents.setExpressionTypingUtils(expressionTypingUtils);
    expressionTypingComponents.setForLoopConventionsChecker(forLoopConventionsChecker);
    expressionTypingComponents.setGlobalContext(globalContext);
    expressionTypingComponents.setPlatformToKotlinClassMap(platformToKotlinClassMap);
    expressionTypingComponents.setReflectionTypes(reflectionTypes);

    forLoopConventionsChecker.setExpressionTypingServices(expressionTypingServices);
    forLoopConventionsChecker.setExpressionTypingUtils(expressionTypingUtils);
    forLoopConventionsChecker.setProject(project);

    callExpressionResolver.setExpressionTypingServices(expressionTypingServices);

    descriptorResolver.setAnnotationResolver(annotationResolver);
    descriptorResolver.setDelegatedPropertyResolver(delegatedPropertyResolver);
    descriptorResolver.setExpressionTypingServices(expressionTypingServices);
    descriptorResolver.setStorageManager(storageManager);
    descriptorResolver.setTypeResolver(typeResolver);

    delegatedPropertyResolver.setCallResolver(callResolver);
    delegatedPropertyResolver.setExpressionTypingServices(expressionTypingServices);

    typeResolver.setAnnotationResolver(annotationResolver);
    typeResolver.setModuleDescriptor(moduleDescriptor);
    typeResolver.setQualifiedExpressionResolver(qualifiedExpressionResolver);

    candidateResolver.setArgumentTypeResolver(argumentTypeResolver);

    controlFlowAnalyzer.setTrace(bindingTrace);

    declarationsChecker.setDescriptorResolver(descriptorResolver);
    declarationsChecker.setTrace(bindingTrace);

    functionAnalyzerExtension.setTrace(bindingTrace);

    scriptBodyResolver.setExpressionTypingServices(expressionTypingServices);
  }