Optimize getFqName calls in KotlinBuiltIns

Check the simple name first, and only then construct the full FqName, in all
'is*' methods
This commit is contained in:
Alexander Udalov
2016-01-25 18:06:12 +03:00
parent 04026dbe84
commit 7d880f10ec
3 changed files with 19 additions and 27 deletions
@@ -61,7 +61,7 @@ private class ClassClsStubBuilder(
private val supertypeIds = run {
val supertypeIds = classProto.supertypes(c.typeTable).map { c.nameResolver.getClassId(it.className) }
//empty supertype list if single supertype is Any
if (supertypeIds.singleOrNull()?.let { KotlinBuiltIns.isAny(it.asSingleFqName().toUnsafe()) } ?: false) {
if (supertypeIds.singleOrNull()?.let { KotlinBuiltIns.FQ_NAMES.any == it.asSingleFqName().toUnsafe() } ?: false) {
listOf()
}
else {
@@ -253,7 +253,7 @@ class TypeClsStubBuilder(private val c: ClsStubBuilderContext) {
private fun Type.isDefaultUpperBound(): Boolean {
return this.hasClassName() &&
c.nameResolver.getClassId(className).let { KotlinBuiltIns.isAny(it.asSingleFqName().toUnsafe()) } &&
c.nameResolver.getClassId(className).let { KotlinBuiltIns.FQ_NAMES.any == it.asSingleFqName().toUnsafe() } &&
this.nullable
}
}