Resolution Facade: Add explicit property for file target platform
This commit is contained in:
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.ImportPath
|
||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
|
||||
@JvmOverloads
|
||||
fun KtPsiFactory(project: Project?, markGenerated: Boolean = true): KtPsiFactory = KtPsiFactory(project!!, markGenerated)
|
||||
@@ -45,6 +46,7 @@ private val DO_NOT_ANALYZE_NOTIFICATION = "This file was created by KtPsiFactory
|
||||
var KtFile.doNotAnalyze: String? by UserDataProperty(Key.create("DO_NOT_ANALYZE"))
|
||||
var KtFile.analysisContext: PsiElement? by UserDataProperty(Key.create("ANALYSIS_CONTEXT"))
|
||||
var PsiFile.moduleInfo: ModuleInfo? by UserDataProperty(Key.create("MODULE_INFO"))
|
||||
var KtFile.targetPlatform: TargetPlatform? by UserDataProperty(Key.create("TARGET_PLATFORM"))
|
||||
|
||||
/**
|
||||
* @param markGenerated This needs to be set to true if the `KtPsiFactory` is going to be used for creating elements that are going
|
||||
|
||||
@@ -38,6 +38,9 @@ public class TargetPlatformDetector {
|
||||
|
||||
@NotNull
|
||||
public static TargetPlatform getPlatform(@NotNull KtFile file) {
|
||||
TargetPlatform explicitPlatform = KtPsiFactoryKt.getTargetPlatform(file);
|
||||
if (explicitPlatform != null) return explicitPlatform;
|
||||
|
||||
if (file instanceof KtCodeFragment) {
|
||||
KtFile contextFile = ((KtCodeFragment) file).getContextContainingFile();
|
||||
if (contextFile != null) {
|
||||
|
||||
Reference in New Issue
Block a user