Refactor: Pass TargetPlatform instead of configurator, hide DynamicTypesSettings inside configurator
This commit is contained in:
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.resolve.BodyResolveCache
|
||||
import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzerForTopLevel
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaClassFinderPostConstruct
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformConfigurator
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
||||
import org.jetbrains.kotlin.resolve.lazy.FileScopeProvider
|
||||
import org.jetbrains.kotlin.resolve.lazy.FileScopeProviderImpl
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
@@ -39,7 +39,7 @@ public fun createContainerForReplWithJava(
|
||||
moduleContext: ModuleContext, bindingTrace: BindingTrace, declarationProviderFactory: DeclarationProviderFactory,
|
||||
moduleContentScope: GlobalSearchScope, additionalFileScopeProvider: FileScopeProvider.AdditionalScopes
|
||||
): ContainerForReplWithJava = createContainer("ReplWithJava") {
|
||||
configureModule(moduleContext, JvmPlatformConfigurator, bindingTrace)
|
||||
configureModule(moduleContext, JvmPlatform, bindingTrace)
|
||||
configureJavaTopDownAnalysis(moduleContentScope, moduleContext.project, UsageCollector.DO_NOTHING)
|
||||
|
||||
useInstance(additionalFileScopeProvider)
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzerForTopLevel
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaClassFinderPostConstruct
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaLazyAnalyzerPostConstruct
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformConfigurator
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
||||
import org.jetbrains.kotlin.resolve.lazy.FileScopeProviderImpl
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
|
||||
@@ -74,7 +74,7 @@ public fun createContainerForLazyResolveWithJava(
|
||||
moduleContext: ModuleContext, bindingTrace: BindingTrace, declarationProviderFactory: DeclarationProviderFactory,
|
||||
moduleContentScope: GlobalSearchScope, moduleClassResolver: ModuleClassResolver
|
||||
): Pair<ResolveSession, JavaDescriptorResolver> = createContainer("LazyResolveWithJava") {
|
||||
configureModule(moduleContext, JvmPlatformConfigurator, bindingTrace)
|
||||
configureModule(moduleContext, JvmPlatform, bindingTrace)
|
||||
configureJavaTopDownAnalysis(moduleContentScope, moduleContext.project, UsageCollector.DO_NOTHING)
|
||||
|
||||
useInstance(moduleClassResolver)
|
||||
@@ -97,7 +97,7 @@ public fun createContainerForTopDownAnalyzerForJvm(
|
||||
moduleContentScope: GlobalSearchScope,
|
||||
usageCollector: UsageCollector
|
||||
): ContainerForTopDownAnalyzerForJvm = createContainer("TopDownAnalyzerForJvm") {
|
||||
configureModule(moduleContext, JvmPlatformConfigurator, bindingTrace)
|
||||
configureModule(moduleContext, JvmPlatform, bindingTrace)
|
||||
configureJavaTopDownAnalysis(moduleContentScope, moduleContext.project, usageCollector)
|
||||
|
||||
useInstance(declarationProviderFactory)
|
||||
|
||||
@@ -20,6 +20,6 @@ import org.jetbrains.kotlin.resolve.PlatformConfigurator
|
||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
import org.jetbrains.kotlin.types.DynamicTypesSettings
|
||||
|
||||
public object JvmPlatform : TargetPlatform("JVM", DynamicTypesSettings()) {
|
||||
public object JvmPlatform : TargetPlatform("JVM") {
|
||||
override val platformConfigurator: PlatformConfigurator = JvmPlatformConfigurator
|
||||
}
|
||||
+2
-4
@@ -50,13 +50,11 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.NullabilityInformationSource
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.expressions.SenselessComparisonChecker
|
||||
import org.jetbrains.kotlin.types.flexibility
|
||||
import org.jetbrains.kotlin.types.isFlexible
|
||||
|
||||
public object JvmPlatformConfigurator : PlatformConfigurator(
|
||||
DynamicTypesSettings(),
|
||||
additionalDeclarationCheckers = listOf(
|
||||
PlatformStaticAnnotationChecker(),
|
||||
LocalFunInlineChecker(),
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.types.DynamicTypesSettings
|
||||
import org.jetbrains.kotlin.types.expressions.*
|
||||
|
||||
public fun StorageComponentContainer.configureModule(
|
||||
moduleContext: ModuleContext, platformConfigurator: PlatformConfigurator
|
||||
moduleContext: ModuleContext, platform: TargetPlatform
|
||||
) {
|
||||
useInstance(moduleContext)
|
||||
useInstance(moduleContext.module)
|
||||
@@ -42,42 +42,38 @@ public fun StorageComponentContainer.configureModule(
|
||||
useInstance(moduleContext.builtIns)
|
||||
useInstance(moduleContext.platformToKotlinClassMap)
|
||||
|
||||
useInstance(platformConfigurator)
|
||||
useInstance(platform)
|
||||
|
||||
platformConfigurator.configure(this)
|
||||
platform.platformConfigurator.configure(this)
|
||||
}
|
||||
|
||||
public fun StorageComponentContainer.configureModule(
|
||||
moduleContext: ModuleContext, platformConfigurator: PlatformConfigurator, trace: BindingTrace
|
||||
moduleContext: ModuleContext, platform: TargetPlatform, trace: BindingTrace
|
||||
) {
|
||||
configureModule(moduleContext, platformConfigurator)
|
||||
configureModule(moduleContext, platform)
|
||||
useInstance(trace)
|
||||
}
|
||||
|
||||
public fun createContainerForBodyResolve(
|
||||
moduleContext: ModuleContext, bindingTrace: BindingTrace,
|
||||
platformConfigurator: PlatformConfigurator, statementFilter: StatementFilter,
|
||||
dynamicTypesSettings: DynamicTypesSettings
|
||||
platform: TargetPlatform, statementFilter: StatementFilter
|
||||
): StorageComponentContainer = createContainer("BodyResolve") {
|
||||
configureModule(moduleContext, platformConfigurator, bindingTrace)
|
||||
configureModule(moduleContext, platform, bindingTrace)
|
||||
|
||||
useInstance(statementFilter)
|
||||
useInstance(dynamicTypesSettings)
|
||||
useInstance(BodyResolveCache.ThrowException)
|
||||
useImpl<BodyResolver>()
|
||||
}
|
||||
|
||||
public fun createContainerForLazyBodyResolve(
|
||||
moduleContext: ModuleContext, kotlinCodeAnalyzer: KotlinCodeAnalyzer,
|
||||
bindingTrace: BindingTrace, platformConfigurator: PlatformConfigurator,
|
||||
dynamicTypesSettings: DynamicTypesSettings,
|
||||
bindingTrace: BindingTrace, platform: TargetPlatform,
|
||||
bodyResolveCache: BodyResolveCache
|
||||
): StorageComponentContainer = createContainer("LazyBodyResolve") {
|
||||
configureModule(moduleContext, platformConfigurator, bindingTrace)
|
||||
configureModule(moduleContext, platform, bindingTrace)
|
||||
|
||||
useInstance(kotlinCodeAnalyzer)
|
||||
useInstance(kotlinCodeAnalyzer.getFileScopeProvider())
|
||||
useInstance(dynamicTypesSettings)
|
||||
useInstance(bodyResolveCache)
|
||||
useImpl<LazyTopDownAnalyzerForTopLevel>()
|
||||
}
|
||||
@@ -85,13 +81,11 @@ public fun createContainerForLazyBodyResolve(
|
||||
public fun createContainerForLazyLocalClassifierAnalyzer(
|
||||
moduleContext: ModuleContext,
|
||||
bindingTrace: BindingTrace,
|
||||
platformConfigurator: PlatformConfigurator,
|
||||
dynamicTypesSettings: DynamicTypesSettings,
|
||||
platform: TargetPlatform,
|
||||
localClassDescriptorHolder: LocalClassDescriptorHolder
|
||||
): StorageComponentContainer = createContainer("LocalClassifierAnalyzer") {
|
||||
configureModule(moduleContext, platformConfigurator, bindingTrace)
|
||||
configureModule(moduleContext, platform, bindingTrace)
|
||||
|
||||
useInstance(dynamicTypesSettings)
|
||||
useInstance(localClassDescriptorHolder)
|
||||
|
||||
useImpl<LazyTopDownAnalyzer>()
|
||||
@@ -105,12 +99,13 @@ public fun createContainerForLazyLocalClassifierAnalyzer(
|
||||
}
|
||||
|
||||
private fun createContainerForLazyResolve(
|
||||
moduleContext: ModuleContext, declarationProviderFactory: DeclarationProviderFactory, bindingTrace: BindingTrace,
|
||||
platformConfigurator: PlatformConfigurator, dynamicTypesSettings: DynamicTypesSettings
|
||||
moduleContext: ModuleContext,
|
||||
declarationProviderFactory: DeclarationProviderFactory,
|
||||
bindingTrace: BindingTrace,
|
||||
platform: TargetPlatform
|
||||
): StorageComponentContainer = createContainer("LazyResolve") {
|
||||
configureModule(moduleContext, platformConfigurator, bindingTrace)
|
||||
configureModule(moduleContext, platform, bindingTrace)
|
||||
|
||||
useInstance(dynamicTypesSettings)
|
||||
useInstance(declarationProviderFactory)
|
||||
useInstance(UsageCollector.DO_NOTHING)
|
||||
|
||||
@@ -120,14 +115,12 @@ private fun createContainerForLazyResolve(
|
||||
|
||||
public fun createLazyResolveSession(
|
||||
moduleContext: ModuleContext, declarationProviderFactory: DeclarationProviderFactory, bindingTrace: BindingTrace,
|
||||
platformConfigurator: PlatformConfigurator, dynamicTypesSettings: DynamicTypesSettings
|
||||
): ResolveSession = createContainerForLazyResolve(
|
||||
moduleContext, declarationProviderFactory, bindingTrace, platformConfigurator, dynamicTypesSettings
|
||||
).get<ResolveSession>()
|
||||
platform: TargetPlatform
|
||||
): ResolveSession = createContainerForLazyResolve(moduleContext, declarationProviderFactory, bindingTrace, platform).get<ResolveSession>()
|
||||
|
||||
public fun createContainerForMacros(project: Project, module: ModuleDescriptor): ContainerForMacros {
|
||||
val componentContainer = createContainer("Macros") {
|
||||
configureModule(ModuleContext(module, project), TargetPlatform.Default.platformConfigurator)
|
||||
configureModule(ModuleContext(module, project), TargetPlatform.Default)
|
||||
useImpl<ExpressionTypingServices>()
|
||||
}
|
||||
return ContainerForMacros(componentContainer)
|
||||
|
||||
@@ -24,8 +24,7 @@ import org.jetbrains.kotlin.resolve.validation.SymbolUsageValidator
|
||||
import org.jetbrains.kotlin.types.DynamicTypesSettings
|
||||
|
||||
public abstract class TargetPlatform(
|
||||
public val platformName: String,
|
||||
public val dynamicTypesSettings: DynamicTypesSettings
|
||||
public val platformName: String
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return platformName
|
||||
@@ -33,8 +32,8 @@ public abstract class TargetPlatform(
|
||||
|
||||
public abstract val platformConfigurator: PlatformConfigurator
|
||||
|
||||
public object Default : TargetPlatform("Default", DynamicTypesSettings()) {
|
||||
override val platformConfigurator = PlatformConfigurator(listOf(), listOf(), listOf(), listOf())
|
||||
public object Default : TargetPlatform("Default") {
|
||||
override val platformConfigurator = PlatformConfigurator(DynamicTypesSettings(), listOf(), listOf(), listOf(), listOf())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +44,7 @@ private val DEFAULT_VALIDATORS = listOf(DeprecatedSymbolValidator())
|
||||
|
||||
|
||||
public open class PlatformConfigurator(
|
||||
private val dynamicTypesSettings: DynamicTypesSettings,
|
||||
additionalDeclarationCheckers: List<DeclarationChecker>,
|
||||
additionalCallCheckers: List<CallChecker>,
|
||||
additionalTypeCheckers: List<AdditionalTypeChecker>,
|
||||
@@ -58,6 +58,7 @@ public open class PlatformConfigurator(
|
||||
|
||||
public open fun configure(container: StorageComponentContainer) {
|
||||
with (container) {
|
||||
useInstance(dynamicTypesSettings)
|
||||
declarationCheckers.forEach { useInstance(it) }
|
||||
callCheckers.forEach { useInstance(it) }
|
||||
typeCheckers.forEach { useInstance(it) }
|
||||
|
||||
+2
-3
@@ -52,7 +52,7 @@ public class LocalClassifierAnalyzer(
|
||||
private val funcionDescriptorResolver: FunctionDescriptorResolver,
|
||||
private val typeResolver: TypeResolver,
|
||||
private val annotationResolver: AnnotationResolver,
|
||||
private val platformConfigurator: PlatformConfigurator,
|
||||
private val platform: TargetPlatform,
|
||||
private val dynamicTypesSettings: DynamicTypesSettings
|
||||
) {
|
||||
fun processClassOrObject(
|
||||
@@ -66,8 +66,7 @@ public class LocalClassifierAnalyzer(
|
||||
val container = createContainerForLazyLocalClassifierAnalyzer(
|
||||
moduleContext,
|
||||
context.trace,
|
||||
platformConfigurator,
|
||||
dynamicTypesSettings,
|
||||
platform,
|
||||
LocalClassDescriptorHolder(
|
||||
scope,
|
||||
classOrObject,
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.frontend.di.createLazyResolveSession
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformConfigurator
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
||||
import org.jetbrains.kotlin.resolve.lazy.KotlinTestWithEnvironment
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProviderFactory
|
||||
@@ -53,7 +53,7 @@ public abstract class AbstractDescriptorRendererTest : KotlinTestWithEnvironment
|
||||
context,
|
||||
FileBasedDeclarationProviderFactory(context.storageManager, listOf(psiFile)),
|
||||
CliLightClassGenerationSupport.NoScopeRecordCliBindingTrace(),
|
||||
JvmPlatformConfigurator, DynamicTypesSettings()
|
||||
JvmPlatform
|
||||
)
|
||||
|
||||
context.initializeModuleContents(resolveSession.getPackageFragmentProvider())
|
||||
@@ -81,7 +81,7 @@ public abstract class AbstractDescriptorRendererTest : KotlinTestWithEnvironment
|
||||
val classDescriptor = getDescriptor(jetClassOrObject, resolveSession) as ClassDescriptor
|
||||
addCorrespondingParameterDescriptor(classDescriptor.getUnsubstitutedPrimaryConstructor()!!, parameter)
|
||||
}
|
||||
else -> super.visitParameter(parameter)
|
||||
else -> super.visitParameter(parameter)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,13 +27,13 @@ import org.jetbrains.kotlin.frontend.di.configureModule
|
||||
import org.jetbrains.kotlin.resolve.DescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.FunctionDescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.TypeResolver
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformConfigurator
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices
|
||||
import org.jetbrains.kotlin.types.expressions.FakeCallResolver
|
||||
|
||||
public fun createContainerForTests(project: Project, module: ModuleDescriptor): ContainerForTests {
|
||||
return ContainerForTests(createContainer("Tests") {
|
||||
configureModule(ModuleContext(module, project), JvmPlatformConfigurator)
|
||||
configureModule(ModuleContext(module, project), JvmPlatform)
|
||||
useImpl<ExpressionTypingServices>()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -105,8 +105,7 @@ public class JetDefaultModalityModifiersTest extends JetLiteFixture {
|
||||
new FileBasedDeclarationProviderFactory(moduleContext.getStorageManager(),
|
||||
Collections.singleton(aClass.getContainingJetFile())),
|
||||
new BindingTraceContext(),
|
||||
TargetPlatform.Default.platformConfigurator,
|
||||
new DynamicTypesSettings()
|
||||
TargetPlatform.Default.INSTANCE$
|
||||
);
|
||||
|
||||
return (ClassDescriptorWithResolutionScopes) resolveSession.getClassDescriptor(aClass);
|
||||
|
||||
@@ -130,7 +130,7 @@ public abstract class ElementResolver protected constructor(
|
||||
return statementFilterUsed
|
||||
}
|
||||
|
||||
val trace : BindingTrace = when (resolveElement) {
|
||||
val trace: BindingTrace = when (resolveElement) {
|
||||
is JetNamedFunction -> functionAdditionalResolve(resolveSession, resolveElement, file, createStatementFilter())
|
||||
|
||||
is JetClassInitializer -> initializerAdditionalResolve(resolveSession, resolveElement, file, createStatementFilter())
|
||||
@@ -388,10 +388,11 @@ public abstract class ElementResolver protected constructor(
|
||||
): BodyResolver {
|
||||
val globalContext = SimpleGlobalContext(resolveSession.getStorageManager(), resolveSession.getExceptionTracker())
|
||||
val module = resolveSession.getModuleDescriptor()
|
||||
val targetPlatform = getTargetPlatform(file)
|
||||
return createContainerForBodyResolve(
|
||||
globalContext.withProject(file.getProject()).withModule(module),
|
||||
trace, targetPlatform.platformConfigurator, statementFilter, targetPlatform.dynamicTypesSettings
|
||||
trace,
|
||||
getTargetPlatform(file),
|
||||
statementFilter
|
||||
).get<BodyResolver>()
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||
import org.jetbrains.kotlin.frontend.di.createLazyResolveSession
|
||||
import org.jetbrains.kotlin.idea.framework.KotlinJavaScriptLibraryDetectionUtil
|
||||
import org.jetbrains.kotlin.js.analyze.TopDownAnalyzerFacadeForJS
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformConfigurator
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatform
|
||||
import org.jetbrains.kotlin.resolve.BindingTraceContext
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactoryService
|
||||
@@ -56,9 +56,7 @@ public object JsAnalyzerFacade : AnalyzerFacade<JsResolverForModule, PlatformAna
|
||||
project, moduleContext.storageManager, syntheticFiles, if (moduleInfo.isLibrary) GlobalSearchScope.EMPTY_SCOPE else moduleContentScope
|
||||
)
|
||||
|
||||
val resolveSession = createLazyResolveSession(
|
||||
moduleContext, declarationProviderFactory, BindingTraceContext(), JsPlatformConfigurator, DynamicTypesAllowed()
|
||||
)
|
||||
val resolveSession = createLazyResolveSession(moduleContext, declarationProviderFactory, BindingTraceContext(), JsPlatform)
|
||||
var packageFragmentProvider = resolveSession.getPackageFragmentProvider()
|
||||
|
||||
if (moduleInfo is LibraryInfo && KotlinJavaScriptLibraryDetectionUtil.isKotlinJavaScriptLibrary(moduleInfo.library)) {
|
||||
|
||||
+1
-2
@@ -232,8 +232,7 @@ private object KotlinResolveDataProvider {
|
||||
moduleContext,
|
||||
resolveSession,
|
||||
trace,
|
||||
targetPlatform.platformConfigurator,
|
||||
targetPlatform.dynamicTypesSettings,
|
||||
targetPlatform,
|
||||
resolveSession.getBodyResolveCache()
|
||||
).get<LazyTopDownAnalyzerForTopLevel>()
|
||||
|
||||
|
||||
+1
-2
@@ -254,8 +254,7 @@ public class JetSourceNavigationHelper {
|
||||
newModuleContext,
|
||||
providerFactory,
|
||||
new BindingTraceContext(),
|
||||
TargetPlatform.Default.platformConfigurator,
|
||||
new DynamicTypesSettings()
|
||||
TargetPlatform.Default.INSTANCE$
|
||||
);
|
||||
|
||||
newModuleContext.initializeModuleContents(resolveSession.getPackageFragmentProvider());
|
||||
|
||||
+1
-2
@@ -111,8 +111,7 @@ public class BuiltInsReferenceResolver extends AbstractProjectComponent {
|
||||
DiPackage.createLazyResolveSession(
|
||||
newModuleContext,
|
||||
declarationFactory, new BindingTraceContext(),
|
||||
TargetPlatform.Default.INSTANCE$.getPlatformConfigurator(),
|
||||
new DynamicTypesSettings()
|
||||
TargetPlatform.Default.INSTANCE$
|
||||
);
|
||||
|
||||
newModuleContext.initializeModuleContents(resolveSession.getPackageFragmentProvider());
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.container.useInstance
|
||||
import org.jetbrains.kotlin.context.ModuleContext
|
||||
import org.jetbrains.kotlin.frontend.di.configureModule
|
||||
import org.jetbrains.kotlin.incremental.components.UsageCollector
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatformConfigurator
|
||||
import org.jetbrains.kotlin.js.resolve.JsPlatform
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.BodyResolveCache
|
||||
import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzerForTopLevel
|
||||
@@ -38,7 +38,7 @@ public fun createTopDownAnalyzerForJs(
|
||||
declarationProviderFactory: DeclarationProviderFactory
|
||||
): LazyTopDownAnalyzerForTopLevel {
|
||||
val storageComponentContainer = createContainer("TopDownAnalyzerForJs") {
|
||||
configureModule(moduleContext, JsPlatformConfigurator, bindingTrace)
|
||||
configureModule(moduleContext, JsPlatform, bindingTrace)
|
||||
|
||||
useInstance(declarationProviderFactory)
|
||||
useImpl<FileScopeProviderImpl>()
|
||||
@@ -46,7 +46,6 @@ public fun createTopDownAnalyzerForJs(
|
||||
useInstance(UsageCollector.DO_NOTHING)
|
||||
useImpl<ResolveSession>()
|
||||
useImpl<LazyTopDownAnalyzerForTopLevel>()
|
||||
useImpl<DynamicTypesAllowed>()
|
||||
}
|
||||
return storageComponentContainer.get<LazyTopDownAnalyzerForTopLevel>()
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ import org.jetbrains.kotlin.resolve.PlatformConfigurator
|
||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
import org.jetbrains.kotlin.types.DynamicTypesAllowed
|
||||
|
||||
public object JsPlatform : TargetPlatform("JS", DynamicTypesAllowed()) {
|
||||
public object JsPlatform : TargetPlatform("JS") {
|
||||
override val platformConfigurator: PlatformConfigurator = JsPlatformConfigurator
|
||||
}
|
||||
@@ -18,8 +18,10 @@ package org.jetbrains.kotlin.js.resolve
|
||||
|
||||
import org.jetbrains.kotlin.js.resolve.diagnostics.JsCallChecker
|
||||
import org.jetbrains.kotlin.resolve.PlatformConfigurator
|
||||
import org.jetbrains.kotlin.types.DynamicTypesAllowed
|
||||
|
||||
public object JsPlatformConfigurator : PlatformConfigurator(
|
||||
DynamicTypesAllowed(),
|
||||
additionalDeclarationCheckers = listOf(NativeInvokeChecker(), NativeGetterChecker(), NativeSetterChecker(), ClassDeclarationChecker()),
|
||||
additionalCallCheckers = listOf(JsCallChecker()),
|
||||
additionalTypeCheckers = listOf(),
|
||||
|
||||
Reference in New Issue
Block a user