Rename throw primitives: counterpart to change in Kotlin

(cherry picked from commit 754d9fbdb1d69d06761d886e43adecda987b3915)
This commit is contained in:
Georgy Bronnikov
2020-08-10 13:37:42 +03:00
committed by Vasily Levchenko
parent 15c72a1563
commit 5bdcf23f24
8 changed files with 14 additions and 14 deletions
@@ -254,13 +254,13 @@ internal class KonanSymbols(
val throwIndexOutOfBoundsException = internalFunction("ThrowIndexOutOfBoundsException")
override val ThrowNullPointerException = internalFunction("ThrowNullPointerException")
override val throwNullPointerException = internalFunction("ThrowNullPointerException")
override val ThrowNoWhenBranchMatchedException = internalFunction("ThrowNoWhenBranchMatchedException")
override val throwNoWhenBranchMatchedException = internalFunction("ThrowNoWhenBranchMatchedException")
override val ThrowTypeCastException = internalFunction("ThrowTypeCastException")
override val throwTypeCastException = internalFunction("ThrowTypeCastException")
override val ThrowKotlinNothingValueException = internalFunction("ThrowKotlinNothingValueException")
override val throwKotlinNothingValueException = internalFunction("ThrowKotlinNothingValueException")
val throwClassCastException = internalFunction("ThrowClassCastException")
@@ -271,7 +271,7 @@ internal class KonanSymbols(
val throwIllegalArgumentExceptionWithMessage = internalFunction("ThrowIllegalArgumentExceptionWithMessage")
override val ThrowUninitializedPropertyAccessException = internalFunction("ThrowUninitializedPropertyAccessException")
override val throwUninitializedPropertyAccessException = internalFunction("ThrowUninitializedPropertyAccessException")
override val stringBuilder = symbolTable.referenceClass(
builtInsPackage("kotlin", "text").getContributedClassifier(
@@ -86,7 +86,7 @@ internal class CEnumByValueFunctionGenerator(
)
}
}
+irCall(symbols.ThrowNullPointerException, irBuiltIns.nothingType)
+irCall(symbols.throwNullPointerException, irBuiltIns.nothingType)
})
}
return byValueIrFunction
@@ -1405,7 +1405,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
ifThen(not(genInstanceOf(srcArg, dstClass))) {
if (dstClass.defaultType.isObjCObjectType()) {
callDirect(
context.ir.symbols.ThrowTypeCastException.owner,
context.ir.symbols.throwTypeCastException.owner,
emptyList(),
Lifetime.GLOBAL
)
@@ -273,7 +273,7 @@ private class InlineClassTransformer(private val context: Context) : IrBuildingT
IrBlockImpl(startOffset, endOffset, irBuiltIns.unitType).apply {
statements.addIfNotNull(expression.receiver)
statements += expression.value
statements += IrCallImpl(startOffset, endOffset, irBuiltIns.nothingType, symbols.ThrowNullPointerException)
statements += IrCallImpl(startOffset, endOffset, irBuiltIns.nothingType, symbols.throwNullPointerException)
statements += IrGetObjectValueImpl(startOffset, endOffset, irBuiltIns.unitType, irBuiltIns.unitClass)
}
} else {
@@ -57,8 +57,8 @@ internal class BuiltinOperatorLowering(val context: Context) : FileLoweringPass,
irBuiltins.checkNotNullSymbol -> lowerCheckNotNull(expression)
irBuiltins.noWhenBranchMatchedExceptionSymbol -> IrCallImpl(expression.startOffset, expression.endOffset,
context.ir.symbols.ThrowNoWhenBranchMatchedException.owner.returnType,
context.ir.symbols.ThrowNoWhenBranchMatchedException)
context.ir.symbols.throwNoWhenBranchMatchedException.owner.returnType,
context.ir.symbols.throwNoWhenBranchMatchedException)
else -> expression
}
@@ -181,7 +181,7 @@ internal class BuiltinOperatorLowering(val context: Context) : FileLoweringPass,
private fun lowerCheckNotNull(expression: IrCall) = builder.at(expression).irBlock(resultType = expression.type) {
val temp = irTemporary(expression.getValueArgument(0)!!)
+irIfThen(context.irBuiltIns.unitType, irEqeqNull(irGet(temp)), irCall(symbols.ThrowNullPointerException))
+irIfThen(context.irBuiltIns.unitType, irEqeqNull(irGet(temp)), irCall(symbols.throwNullPointerException))
+irGet(temp)
}
@@ -698,7 +698,7 @@ private class InteropLoweringPart1(val context: Context) : BaseInteropIrTransfor
+irIfThen(
context.irBuiltIns.unitType,
irEqeqeq(irGet(temp), irNull()),
irCall(symbols.ThrowNullPointerException)
irCall(symbols.throwNullPointerException)
)
+irGet(temp)
}
@@ -47,7 +47,7 @@ internal class PostInlineLowering(val context: Context) : FileLoweringPass {
builder.irKClass(context, symbol)
} else {
// E.g. for `T::class` in a body of an inline function itself.
builder.irCall(context.ir.symbols.ThrowNullPointerException.owner)
builder.irCall(context.ir.symbols.throwNullPointerException.owner)
}
}
@@ -47,7 +47,7 @@ private class TypeOperatorTransformer(val context: CommonBackendContext, val fun
private val builder = context.createIrBuilder(function)
val throwNullPointerException = context.ir.symbols.ThrowNullPointerException
val throwNullPointerException = context.ir.symbols.throwNullPointerException
override fun visitFunction(declaration: IrFunction): IrStatement {
// ignore inner functions during this pass