Search in sources :

Example 1 with TargetPlatform

use of org.jetbrains.kotlin.resolve.TargetPlatform in project kotlin by JetBrains.

the class ProjectStructureUtil method getCachedPlatformForModule.

@NotNull
static /* package */
TargetPlatform getCachedPlatformForModule(@NotNull final Module module) {
    CachedValue<TargetPlatform> result = module.getUserData(PLATFORM_FOR_MODULE);
    if (result == null) {
        result = CachedValuesManager.getManager(module.getProject()).createCachedValue(new CachedValueProvider<TargetPlatform>() {

            @Override
            public Result<TargetPlatform> compute() {
                TargetPlatform configuredInFacet = getPlatformConfiguredInFacet(module);
                TargetPlatform platform = configuredInFacet != null ? configuredInFacet : hasJsStandardLibraryInDependencies(module) ? JsPlatform.INSTANCE : JvmPlatform.INSTANCE;
                return Result.create(platform, ProjectRootModificationTracker.getInstance(module.getProject()));
            }
        }, false);
        module.putUserData(PLATFORM_FOR_MODULE, result);
    }
    return result.getValue();
}
Also used : CachedValueProvider(com.intellij.psi.util.CachedValueProvider) TargetPlatform(org.jetbrains.kotlin.resolve.TargetPlatform) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

CachedValueProvider (com.intellij.psi.util.CachedValueProvider)1 NotNull (org.jetbrains.annotations.NotNull)1 TargetPlatform (org.jetbrains.kotlin.resolve.TargetPlatform)1