From e16885c30164473b92266500fc9f0ae91c463477 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Tue, 20 Jan 2015 21:20:18 +0300 Subject: [PATCH] LazyTopDownAnalyzerForTopLevel extracted --- .../kotlin/di/InjectorForReplWithJava.java | 10 ++ .../di/InjectorForTopDownAnalyzerForJvm.java | 10 ++ .../jvm/TopDownAnalyzerFacadeForJVM.java | 2 +- .../InjectorForLazyTopDownAnalyzerBasic.java | 10 ++ .../kotlin/resolve/LazyTopDownAnalyzer.java | 44 --------- .../LazyTopDownAnalyzerForTopLevel.java | 92 +++++++++++++++++++ .../generators/injectors/GenerateInjectors.kt | 3 + .../references/BuiltInsReferenceResolver.java | 4 +- .../di/InjectorForTopDownAnalyzerForJs.java | 10 ++ .../analyze/TopDownAnalyzerFacadeForJS.java | 2 +- 10 files changed, 139 insertions(+), 48 deletions(-) create mode 100644 compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzerForTopLevel.java diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/di/InjectorForReplWithJava.java b/compiler/frontend.java/src/org/jetbrains/kotlin/di/InjectorForReplWithJava.java index fc832176792..6238c2c3b4b 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/di/InjectorForReplWithJava.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/di/InjectorForReplWithJava.java @@ -28,6 +28,7 @@ import org.jetbrains.kotlin.resolve.lazy.ResolveSession; import org.jetbrains.kotlin.resolve.lazy.ScopeProvider; import com.intellij.psi.search.GlobalSearchScope; import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer; +import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzerForTopLevel; import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver; import org.jetbrains.kotlin.load.kotlin.DeserializationComponentsForJava; import org.jetbrains.kotlin.load.kotlin.VirtualFileFinder; @@ -104,6 +105,7 @@ public class InjectorForReplWithJava { private final ScopeProvider scopeProvider; private final GlobalSearchScope moduleContentScope; private final LazyTopDownAnalyzer lazyTopDownAnalyzer; + private final LazyTopDownAnalyzerForTopLevel lazyTopDownAnalyzerForTopLevel; private final JavaDescriptorResolver javaDescriptorResolver; private final DeserializationComponentsForJava deserializationComponentsForJava; private final VirtualFileFinder virtualFileFinder; @@ -183,6 +185,7 @@ public class InjectorForReplWithJava { this.scopeProvider = new ScopeProvider(getResolveSession()); this.moduleContentScope = moduleContentScope; this.lazyTopDownAnalyzer = new LazyTopDownAnalyzer(); + this.lazyTopDownAnalyzerForTopLevel = new LazyTopDownAnalyzerForTopLevel(); this.javaClassFinder = new JavaClassFinderImpl(); this.virtualFileFinder = org.jetbrains.kotlin.load.kotlin.VirtualFileFinderFactory.SERVICE.getInstance(project).create(moduleContentScope); this.traceBasedErrorReporter = new TraceBasedErrorReporter(); @@ -262,6 +265,9 @@ public class InjectorForReplWithJava { this.lazyTopDownAnalyzer.setTrace(bindingTrace); this.lazyTopDownAnalyzer.setVarianceChecker(varianceChecker); + this.lazyTopDownAnalyzerForTopLevel.setKotlinCodeAnalyzer(resolveSession); + this.lazyTopDownAnalyzerForTopLevel.setLazyTopDownAnalyzer(lazyTopDownAnalyzer); + javaClassFinder.setComponentPostConstruct(javaLazyAnalyzerPostConstruct); javaClassFinder.setProject(project); javaClassFinder.setScope(moduleContentScope); @@ -401,6 +407,10 @@ public class InjectorForReplWithJava { return this.lazyTopDownAnalyzer; } + public LazyTopDownAnalyzerForTopLevel getLazyTopDownAnalyzerForTopLevel() { + return this.lazyTopDownAnalyzerForTopLevel; + } + public JavaDescriptorResolver getJavaDescriptorResolver() { return this.javaDescriptorResolver; } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/di/InjectorForTopDownAnalyzerForJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/di/InjectorForTopDownAnalyzerForJvm.java index 6d39320e0e2..955fab85fd8 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/di/InjectorForTopDownAnalyzerForJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/di/InjectorForTopDownAnalyzerForJvm.java @@ -28,6 +28,7 @@ import org.jetbrains.kotlin.resolve.lazy.ResolveSession; import org.jetbrains.kotlin.resolve.lazy.ScopeProvider; import com.intellij.psi.search.GlobalSearchScope; import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer; +import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzerForTopLevel; import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver; import org.jetbrains.kotlin.load.kotlin.DeserializationComponentsForJava; import org.jetbrains.kotlin.load.kotlin.VirtualFileFinder; @@ -104,6 +105,7 @@ public class InjectorForTopDownAnalyzerForJvm { private final ScopeProvider scopeProvider; private final GlobalSearchScope moduleContentScope; private final LazyTopDownAnalyzer lazyTopDownAnalyzer; + private final LazyTopDownAnalyzerForTopLevel lazyTopDownAnalyzerForTopLevel; private final JavaDescriptorResolver javaDescriptorResolver; private final DeserializationComponentsForJava deserializationComponentsForJava; private final VirtualFileFinder virtualFileFinder; @@ -182,6 +184,7 @@ public class InjectorForTopDownAnalyzerForJvm { this.scopeProvider = new ScopeProvider(getResolveSession()); this.moduleContentScope = moduleContentScope; this.lazyTopDownAnalyzer = new LazyTopDownAnalyzer(); + this.lazyTopDownAnalyzerForTopLevel = new LazyTopDownAnalyzerForTopLevel(); this.javaClassFinder = new JavaClassFinderImpl(); this.virtualFileFinder = org.jetbrains.kotlin.load.kotlin.VirtualFileFinderFactory.SERVICE.getInstance(project).create(moduleContentScope); this.traceBasedErrorReporter = new TraceBasedErrorReporter(); @@ -261,6 +264,9 @@ public class InjectorForTopDownAnalyzerForJvm { this.lazyTopDownAnalyzer.setTrace(bindingTrace); this.lazyTopDownAnalyzer.setVarianceChecker(varianceChecker); + this.lazyTopDownAnalyzerForTopLevel.setKotlinCodeAnalyzer(resolveSession); + this.lazyTopDownAnalyzerForTopLevel.setLazyTopDownAnalyzer(lazyTopDownAnalyzer); + javaClassFinder.setComponentPostConstruct(javaLazyAnalyzerPostConstruct); javaClassFinder.setProject(project); javaClassFinder.setScope(moduleContentScope); @@ -400,6 +406,10 @@ public class InjectorForTopDownAnalyzerForJvm { return this.lazyTopDownAnalyzer; } + public LazyTopDownAnalyzerForTopLevel getLazyTopDownAnalyzerForTopLevel() { + return this.lazyTopDownAnalyzerForTopLevel; + } + public JavaDescriptorResolver getJavaDescriptorResolver() { return this.javaDescriptorResolver; } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/TopDownAnalyzerFacadeForJVM.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/TopDownAnalyzerFacadeForJVM.java index 84a57efbe4e..6e24b7904fc 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/TopDownAnalyzerFacadeForJVM.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/TopDownAnalyzerFacadeForJVM.java @@ -146,7 +146,7 @@ public enum TopDownAnalyzerFacadeForJVM { } additionalProviders.add(injector.getJavaDescriptorResolver().getPackageFragmentProvider()); - injector.getLazyTopDownAnalyzer().analyzeFiles(topDownAnalysisParameters, files, additionalProviders); + injector.getLazyTopDownAnalyzerForTopLevel().analyzeFiles(topDownAnalysisParameters, files, additionalProviders); return AnalysisResult.success(trace.getBindingContext(), module); } finally { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/di/InjectorForLazyTopDownAnalyzerBasic.java b/compiler/frontend/src/org/jetbrains/kotlin/di/InjectorForLazyTopDownAnalyzerBasic.java index 975e607b971..c8562e61348 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/di/InjectorForLazyTopDownAnalyzerBasic.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/di/InjectorForLazyTopDownAnalyzerBasic.java @@ -27,6 +27,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory import org.jetbrains.kotlin.resolve.lazy.ResolveSession; import org.jetbrains.kotlin.resolve.lazy.ScopeProvider; import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer; +import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzerForTopLevel; import org.jetbrains.kotlin.resolve.AdditionalCheckerProvider.DefaultProvider; import org.jetbrains.kotlin.resolve.AnnotationResolver; import org.jetbrains.kotlin.resolve.calls.CallResolver; @@ -83,6 +84,7 @@ public class InjectorForLazyTopDownAnalyzerBasic { private final ResolveSession resolveSession; private final ScopeProvider scopeProvider; private final LazyTopDownAnalyzer lazyTopDownAnalyzer; + private final LazyTopDownAnalyzerForTopLevel lazyTopDownAnalyzerForTopLevel; private final DefaultProvider defaultProvider; private final AnnotationResolver annotationResolver; private final CallResolver callResolver; @@ -140,6 +142,7 @@ public class InjectorForLazyTopDownAnalyzerBasic { this.resolveSession = new ResolveSession(project, globalContext, module, declarationProviderFactory, bindingTrace); this.scopeProvider = new ScopeProvider(getResolveSession()); this.lazyTopDownAnalyzer = new LazyTopDownAnalyzer(); + this.lazyTopDownAnalyzerForTopLevel = new LazyTopDownAnalyzerForTopLevel(); this.defaultProvider = DefaultProvider.INSTANCE$; this.annotationResolver = new AnnotationResolver(); this.callResolver = new CallResolver(); @@ -200,6 +203,9 @@ public class InjectorForLazyTopDownAnalyzerBasic { this.lazyTopDownAnalyzer.setTrace(bindingTrace); this.lazyTopDownAnalyzer.setVarianceChecker(varianceChecker); + this.lazyTopDownAnalyzerForTopLevel.setKotlinCodeAnalyzer(resolveSession); + this.lazyTopDownAnalyzerForTopLevel.setLazyTopDownAnalyzer(lazyTopDownAnalyzer); + annotationResolver.setCallResolver(callResolver); annotationResolver.setStorageManager(storageManager); annotationResolver.setTypeResolver(typeResolver); @@ -312,4 +318,8 @@ public class InjectorForLazyTopDownAnalyzerBasic { return this.lazyTopDownAnalyzer; } + public LazyTopDownAnalyzerForTopLevel getLazyTopDownAnalyzerForTopLevel() { + return this.lazyTopDownAnalyzerForTopLevel; + } + } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.java index 24f22851b12..0fed844427d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.java @@ -20,12 +20,9 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import com.intellij.psi.PsiElement; import com.intellij.psi.util.PsiTreeUtil; -import kotlin.KotlinPackage; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.descriptors.*; -import org.jetbrains.kotlin.descriptors.impl.CompositePackageFragmentProvider; -import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl; import org.jetbrains.kotlin.name.FqName; import org.jetbrains.kotlin.psi.*; import org.jetbrains.kotlin.resolve.lazy.KotlinCodeAnalyzer; @@ -36,7 +33,6 @@ import org.jetbrains.kotlin.resolve.varianceChecker.VarianceChecker; import javax.inject.Inject; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -100,29 +96,6 @@ public class LazyTopDownAnalyzer { this.bodyResolver = bodyResolver; } - @NotNull - public TopDownAnalysisContext analyzeFiles( - @NotNull TopDownAnalysisParameters topDownAnalysisParameters, - @NotNull Collection files, - @NotNull List additionalProviders - ) { - assert topDownAnalysisParameters.isLazy() : "Lazy analyzer is run in non-lazy mode"; - - PackageFragmentProvider provider; - if (additionalProviders.isEmpty()) { - provider = resolveSession.getPackageFragmentProvider(); - } - else { - provider = new CompositePackageFragmentProvider(KotlinPackage.plus( - Arrays.asList(resolveSession.getPackageFragmentProvider()), - additionalProviders)); - } - - ((ModuleDescriptorImpl) resolveSession.getModuleDescriptor()).initialize(provider); - - return analyzeDeclarations(topDownAnalysisParameters, files); - } - @NotNull public TopDownAnalysisContext analyzeDeclarations( @NotNull TopDownAnalysisParameters topDownAnalysisParameters, @@ -293,8 +266,6 @@ public class LazyTopDownAnalyzer { varianceChecker.check(c); - resolveImportsInAllFiles(c, resolveSession); - declarationResolver.resolveAnnotationsOnFiles(c, resolveSession.getScopeProvider()); overloadResolver.process(c); @@ -304,16 +275,6 @@ public class LazyTopDownAnalyzer { return c; } - private static void resolveImportsInAllFiles(TopDownAnalysisContext c, KotlinCodeAnalyzer resolveSession) { - for (JetFile file : c.getFiles()) { - resolveAndCheckImports(file, resolveSession); - } - - for (JetScript script : c.getScripts().keySet()) { - resolveAndCheckImports(script.getContainingJetFile(), resolveSession); - } - } - private static void resolveAllHeadersInClasses(TopDownAnalysisContext c) { for (ClassDescriptorWithResolutionScopes classDescriptor : c.getAllClasses()) { ((LazyClassDescriptor) classDescriptor).resolveMemberHeaders(); @@ -352,11 +313,6 @@ public class LazyTopDownAnalyzer { } } - private static void resolveAndCheckImports(@NotNull JetFile file, @NotNull KotlinCodeAnalyzer resolveSession) { - LazyFileScope fileScope = resolveSession.getScopeProvider().getFileScope(file); - fileScope.forceResolveAllImports(); - } - private static void registerScope( @NotNull TopDownAnalysisContext c, @NotNull KotlinCodeAnalyzer resolveSession, diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzerForTopLevel.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzerForTopLevel.java new file mode 100644 index 00000000000..b42641304e4 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzerForTopLevel.java @@ -0,0 +1,92 @@ +/* + * Copyright 2010-2015 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.kotlin.resolve; + +import kotlin.KotlinPackage; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.kotlin.descriptors.PackageFragmentProvider; +import org.jetbrains.kotlin.descriptors.impl.CompositePackageFragmentProvider; +import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl; +import org.jetbrains.kotlin.psi.JetFile; +import org.jetbrains.kotlin.psi.JetScript; +import org.jetbrains.kotlin.resolve.lazy.KotlinCodeAnalyzer; +import org.jetbrains.kotlin.resolve.lazy.LazyFileScope; + +import javax.inject.Inject; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +public class LazyTopDownAnalyzerForTopLevel { + + private KotlinCodeAnalyzer resolveSession; + private LazyTopDownAnalyzer lazyTopDownAnalyzer; + + @Inject + public void setKotlinCodeAnalyzer(@NotNull KotlinCodeAnalyzer kotlinCodeAnalyzer) { + this.resolveSession = kotlinCodeAnalyzer; + } + + @Inject + public void setLazyTopDownAnalyzer(@NotNull LazyTopDownAnalyzer lazyTopDownAnalyzer) { + this.lazyTopDownAnalyzer = lazyTopDownAnalyzer; + } + + @NotNull + public TopDownAnalysisContext analyzeFiles( + @NotNull TopDownAnalysisParameters topDownAnalysisParameters, + @NotNull Collection files, + @NotNull List additionalProviders + ) { + assert topDownAnalysisParameters.isLazy() : "Lazy analyzer is run in non-lazy mode"; + + PackageFragmentProvider provider; + if (additionalProviders.isEmpty()) { + provider = resolveSession.getPackageFragmentProvider(); + } + else { + provider = new CompositePackageFragmentProvider(KotlinPackage.plus( + Arrays.asList(resolveSession.getPackageFragmentProvider()), + additionalProviders)); + } + + ((ModuleDescriptorImpl) resolveSession.getModuleDescriptor()).initialize(provider); + + TopDownAnalysisContext c = lazyTopDownAnalyzer.analyzeDeclarations(topDownAnalysisParameters, files); + + resolveImportsInAllFiles(c, resolveSession); + + return c; + } + + private static void resolveImportsInAllFiles(TopDownAnalysisContext c, KotlinCodeAnalyzer resolveSession) { + for (JetFile file : c.getFiles()) { + resolveAndCheckImports(file, resolveSession); + } + + for (JetScript script : c.getScripts().keySet()) { + resolveAndCheckImports(script.getContainingJetFile(), resolveSession); + } + } + + private static void resolveAndCheckImports(@NotNull JetFile file, @NotNull KotlinCodeAnalyzer resolveSession) { + LazyFileScope fileScope = resolveSession.getScopeProvider().getFileScope(file); + fileScope.forceResolveAllImports(); + } +} + + diff --git a/generators/src/org/jetbrains/kotlin/generators/injectors/GenerateInjectors.kt b/generators/src/org/jetbrains/kotlin/generators/injectors/GenerateInjectors.kt index 182439e04e5..29584758f66 100644 --- a/generators/src/org/jetbrains/kotlin/generators/injectors/GenerateInjectors.kt +++ b/generators/src/org/jetbrains/kotlin/generators/injectors/GenerateInjectors.kt @@ -104,6 +104,7 @@ private fun generatorForLazyTopDownAnalyzerBasic() = commonForResolveSessionBased() publicField() + publicField() field() } @@ -127,6 +128,7 @@ private fun generatorForTopDownAnalyzerForJs() = commonForResolveSessionBased() publicField() + publicField() field() field() @@ -281,6 +283,7 @@ private fun DependencyInjectorGenerator.commonForJavaTopDownAnalyzer() { parameter(name = "moduleContentScope") publicField() + publicField() publicField() publicField() diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/BuiltInsReferenceResolver.java b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/BuiltInsReferenceResolver.java index 0702a3fcb6a..1569c90d144 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/BuiltInsReferenceResolver.java +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/BuiltInsReferenceResolver.java @@ -110,8 +110,8 @@ public class BuiltInsReferenceResolver extends AbstractProjectComponent { FileBasedDeclarationProviderFactory declarationFactory = new FileBasedDeclarationProviderFactory(topDownAnalysisParameters.getStorageManager(), jetBuiltInsFiles); - LazyTopDownAnalyzer analyzer = new InjectorForLazyTopDownAnalyzerBasic( - myProject, topDownAnalysisParameters, trace, module, declarationFactory).getLazyTopDownAnalyzer(); + LazyTopDownAnalyzerForTopLevel analyzer = new InjectorForLazyTopDownAnalyzerBasic( + myProject, topDownAnalysisParameters, trace, module, declarationFactory).getLazyTopDownAnalyzerForTopLevel(); analyzer.analyzeFiles(topDownAnalysisParameters, jetBuiltInsFiles, Collections.emptyList()); diff --git a/js/js.frontend/src/org/jetbrains/kotlin/di/InjectorForTopDownAnalyzerForJs.java b/js/js.frontend/src/org/jetbrains/kotlin/di/InjectorForTopDownAnalyzerForJs.java index 4a17c586033..40eadf5c3b0 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/di/InjectorForTopDownAnalyzerForJs.java +++ b/js/js.frontend/src/org/jetbrains/kotlin/di/InjectorForTopDownAnalyzerForJs.java @@ -27,6 +27,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory import org.jetbrains.kotlin.resolve.lazy.ResolveSession; import org.jetbrains.kotlin.resolve.lazy.ScopeProvider; import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer; +import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzerForTopLevel; import org.jetbrains.kotlin.js.resolve.KotlinJsCheckerProvider; import org.jetbrains.kotlin.types.DynamicTypesAllowed; import org.jetbrains.kotlin.resolve.AnnotationResolver; @@ -83,6 +84,7 @@ public class InjectorForTopDownAnalyzerForJs { private final ResolveSession resolveSession; private final ScopeProvider scopeProvider; private final LazyTopDownAnalyzer lazyTopDownAnalyzer; + private final LazyTopDownAnalyzerForTopLevel lazyTopDownAnalyzerForTopLevel; private final KotlinJsCheckerProvider kotlinJsCheckerProvider; private final DynamicTypesAllowed dynamicTypesAllowed; private final AnnotationResolver annotationResolver; @@ -140,6 +142,7 @@ public class InjectorForTopDownAnalyzerForJs { this.resolveSession = new ResolveSession(project, globalContext, module, declarationProviderFactory, bindingTrace); this.scopeProvider = new ScopeProvider(getResolveSession()); this.lazyTopDownAnalyzer = new LazyTopDownAnalyzer(); + this.lazyTopDownAnalyzerForTopLevel = new LazyTopDownAnalyzerForTopLevel(); this.kotlinJsCheckerProvider = KotlinJsCheckerProvider.INSTANCE$; this.dynamicTypesAllowed = new DynamicTypesAllowed(); this.annotationResolver = new AnnotationResolver(); @@ -200,6 +203,9 @@ public class InjectorForTopDownAnalyzerForJs { this.lazyTopDownAnalyzer.setTrace(bindingTrace); this.lazyTopDownAnalyzer.setVarianceChecker(varianceChecker); + this.lazyTopDownAnalyzerForTopLevel.setKotlinCodeAnalyzer(resolveSession); + this.lazyTopDownAnalyzerForTopLevel.setLazyTopDownAnalyzer(lazyTopDownAnalyzer); + annotationResolver.setCallResolver(callResolver); annotationResolver.setStorageManager(storageManager); annotationResolver.setTypeResolver(typeResolver); @@ -312,4 +318,8 @@ public class InjectorForTopDownAnalyzerForJs { return this.lazyTopDownAnalyzer; } + public LazyTopDownAnalyzerForTopLevel getLazyTopDownAnalyzerForTopLevel() { + return this.lazyTopDownAnalyzerForTopLevel; + } + } diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/analyze/TopDownAnalyzerFacadeForJS.java b/js/js.frontend/src/org/jetbrains/kotlin/js/analyze/TopDownAnalyzerFacadeForJS.java index b15fa0a1724..4b0e4dadc64 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/js/analyze/TopDownAnalyzerFacadeForJS.java +++ b/js/js.frontend/src/org/jetbrains/kotlin/js/analyze/TopDownAnalyzerFacadeForJS.java @@ -107,7 +107,7 @@ public final class TopDownAnalyzerFacadeForJS { project, topDownAnalysisParameters, trace, module, new FileBasedDeclarationProviderFactory(topDownAnalysisParameters.getStorageManager(), allFiles)); try { - injector.getLazyTopDownAnalyzer().analyzeFiles(topDownAnalysisParameters, allFiles, + injector.getLazyTopDownAnalyzerForTopLevel().analyzeFiles(topDownAnalysisParameters, allFiles, Collections.emptyList()); return AnalysisResult.success(trace.getBindingContext(), module); }