Refactor: Move TargetPlatform to frontend, make it expose platform dependant resolve services

AdditionalCheckerProvider -> PlatformConfigurator which operates directly on container
This commit is contained in:
Pavel V. Talanov
2015-07-22 20:18:38 +03:00
parent b452c20cc2
commit 84b8ed00c5
55 changed files with 309 additions and 311 deletions
@@ -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.KotlinJsCheckerProvider
import org.jetbrains.kotlin.js.resolve.JsPlatformConfigurator
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, KotlinJsCheckerProvider, bindingTrace)
configureModule(moduleContext, JsPlatformConfigurator, bindingTrace)
useInstance(declarationProviderFactory)
useImpl<FileScopeProviderImpl>()
@@ -0,0 +1,25 @@
/*
* 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.js.resolve
import org.jetbrains.kotlin.resolve.PlatformConfigurator
import org.jetbrains.kotlin.resolve.TargetPlatform
import org.jetbrains.kotlin.types.DynamicTypesAllowed
public object JsPlatform : TargetPlatform("JS", DynamicTypesAllowed()) {
override val platformConfigurator: PlatformConfigurator = JsPlatformConfigurator
}
@@ -17,9 +17,9 @@
package org.jetbrains.kotlin.js.resolve
import org.jetbrains.kotlin.js.resolve.diagnostics.JsCallChecker
import org.jetbrains.kotlin.resolve.AdditionalCheckerProvider
import org.jetbrains.kotlin.resolve.PlatformConfigurator
public object KotlinJsCheckerProvider : AdditionalCheckerProvider(
public object JsPlatformConfigurator : PlatformConfigurator(
additionalDeclarationCheckers = listOf(NativeInvokeChecker(), NativeGetterChecker(), NativeSetterChecker(), ClassDeclarationChecker()),
additionalCallCheckers = listOf(JsCallChecker()),
additionalTypeCheckers = listOf(),