Add builtIns property to TargetPlatform

Add utility to get TargetPlatform by JetElement
This commit is contained in:
Pavel V. Talanov
2015-09-22 15:10:32 +03:00
parent 51113c10b4
commit 315809a34b
2 changed files with 25 additions and 0 deletions
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.resolve
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.container.StorageComponentContainer
import org.jetbrains.kotlin.container.useInstance
import org.jetbrains.kotlin.resolve.calls.checkers.*
@@ -32,6 +33,7 @@ public abstract class TargetPlatform(
}
public abstract val platformConfigurator: PlatformConfigurator
public val builtIns: KotlinBuiltIns = KotlinBuiltIns.getInstance()
public object Default : TargetPlatform("Default") {
override val platformConfigurator = PlatformConfigurator(DynamicTypesSettings(), listOf(), listOf(), listOf(), listOf(), listOf())
@@ -0,0 +1,23 @@
/*
* 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.idea.project
import org.jetbrains.kotlin.psi.JetElement
import org.jetbrains.kotlin.resolve.TargetPlatform
val JetElement.platform: TargetPlatform
get() = TargetPlatformDetector.getPlatform(getContainingJetFile())