Micro optimization to avoid computing class FQ name when not necessary

KotlinBuiltIns.isConstructedFromGivenClass checks the simple name of the
class first, and only computes the full FQ name if it matches the last
segment of the expected FQ name
This commit is contained in:
Alexander Udalov
2017-06-20 19:33:22 +03:00
parent aed5b934f8
commit 5a25ba199a
8 changed files with 13 additions and 18 deletions
@@ -30,8 +30,6 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getType
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.builtIns
import org.jetbrains.kotlin.types.typeUtil.immediateSupertypes
import org.jetbrains.kotlin.types.typeUtil.isConstructedFromClassWithGivenFqName
import org.jetbrains.kotlin.types.typeUtil.isPrimitiveNumberType
class ConvertTwoComparisonsToRangeCheckInspection : IntentionBasedInspection<KtBinaryExpression>(
@@ -189,4 +187,4 @@ class ConvertTwoComparisonsToRangeCheckIntention : SelfTargetingOffsetIndependen
this ?: return false
return this.isInteger()|| KotlinBuiltIns.isChar(this)
}
}
}