JVM IR: micro-optimization in IrType.erasedUpperBound
Avoid `is` on interfaces, use classes instead.
This commit is contained in:
committed by
Space Team
parent
35d498847e
commit
d1f884bad9
@@ -91,13 +91,16 @@ val IrTypeParameter.erasedUpperBound: IrClass
|
|||||||
}
|
}
|
||||||
|
|
||||||
val IrType.erasedUpperBound: IrClass
|
val IrType.erasedUpperBound: IrClass
|
||||||
get() =
|
get() = when (this) {
|
||||||
when (val classifier = classifierOrNull) {
|
is IrSimpleType -> when (val classifier = classifier.owner) {
|
||||||
is IrClassSymbol -> classifier.owner
|
is IrClass -> classifier
|
||||||
is IrTypeParameterSymbol -> classifier.owner.erasedUpperBound
|
is IrTypeParameter -> classifier.erasedUpperBound
|
||||||
is IrScriptSymbol -> classifier.owner.targetClass!!.owner
|
is IrScript -> classifier.targetClass!!.owner
|
||||||
null -> if (this is IrErrorType) symbol.owner else error(render())
|
else -> error(render())
|
||||||
}
|
}
|
||||||
|
is IrErrorType -> symbol.owner
|
||||||
|
else -> error(render())
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the default null/0 value for the type.
|
* Get the default null/0 value for the type.
|
||||||
|
|||||||
Reference in New Issue
Block a user