[uast, reactor] getting rid of analysis.kt because it uses deprecated getLanguagePlugin()

GitOrigin-RevId: cf441c675f97c5b64deff1c7b2a1c66ab40a4038
This commit is contained in:
Nicolay Mitropolsky
2019-08-12 17:03:47 +03:00
committed by intellij-monorepo-bot
parent d9bab91130
commit 63f78b37c5
3 changed files with 3 additions and 13 deletions
@@ -18,7 +18,7 @@ interface UastAnalysisPlugin {
val language: Language
fun <T : Any> getExpressionFact(expression: UExpression, fact: UExpressionFact<T>): T?
fun <T : Any> UExpression.getExpressionFact(fact: UExpressionFact<T>): T?
}
sealed class UExpressionFact<T : Any> {
@@ -1,10 +0,0 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.uast.analysis
import org.jetbrains.uast.UExpression
import org.jetbrains.uast.getLanguagePlugin
fun <T : Any> UExpression.getExpressionFact(fact: UExpressionFact<T>): T? =
this.getLanguagePlugin().analysisPlugin?.getExpressionFact(this, fact)
fun UExpression.canBeAnalyzedByUast() = this.getLanguagePlugin().analysisPlugin != null
@@ -12,10 +12,10 @@ import org.jetbrains.uast.analysis.UNullability
import org.jetbrains.uast.analysis.UastAnalysisPlugin
class JavaUastAnalysisPlugin : UastAnalysisPlugin {
override fun <T : Any> getExpressionFact(expression: UExpression, fact: UExpressionFact<T>): T? {
override fun <T : Any> UExpression.getExpressionFact(fact: UExpressionFact<T>): T? {
when (fact) {
is UExpressionFact.UNullabilityFact -> {
val psiExpression = expression.sourcePsi as? PsiExpression ?: return null
val psiExpression = sourcePsi as? PsiExpression ?: return null
val nullability = CommonDataflow.getExpressionFact(psiExpression, DfaFactType.NULLABILITY)?.toUNullability()
?: UNullability.UNKNOWN