LazyTopDownAnalyzerForTopLevel extracted

This commit is contained in:
Andrey Breslav
2015-01-20 21:20:18 +03:00
parent 6285efe32d
commit e16885c301
10 changed files with 139 additions and 48 deletions
@@ -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;
}
}
@@ -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.<PackageFragmentProvider>emptyList());
return AnalysisResult.success(trace.getBindingContext(), module);
}