[FIR] Add FirCheckNotNullCall converted to CHECK_NOT_NULL intrinsic

function call.
This commit is contained in:
Mark Punzalan
2019-12-02 22:57:24 -08:00
committed by Dmitriy Novozhilov
parent 6bc0fe121a
commit 692a83f7bb
72 changed files with 363 additions and 355 deletions
@@ -306,28 +306,33 @@ class ExpressionsConverter(
}
val operationToken = operationTokenName.getOperationSymbol()
if (operationToken == EXCLEXCL) {
return argument.bangBangToWhen(null) { getAsFirExpression(this, it) }
}
val conventionCallName = operationToken.toUnaryName()
return if (conventionCallName != null) {
if (operationToken in OperatorConventions.INCREMENT_OPERATIONS) {
return generateIncrementOrDecrementBlock(
null,
argument,
callName = conventionCallName,
prefix = unaryExpression.tokenType == PREFIX_EXPRESSION
) { getAsFirExpression(this) }
return when {
operationToken == EXCLEXCL -> {
FirCheckNotNullCallImpl(null).apply {
arguments += getAsFirExpression<FirExpression>(argument, "No operand")
}
}
FirFunctionCallImpl(null).apply {
calleeReference = FirSimpleNamedReference(null, conventionCallName, null)
explicitReceiver = getAsFirExpression(argument, "No operand")
conventionCallName != null -> {
if (operationToken in OperatorConventions.INCREMENT_OPERATIONS) {
return generateIncrementOrDecrementBlock(
null,
argument,
callName = conventionCallName,
prefix = unaryExpression.tokenType == PREFIX_EXPRESSION
) { getAsFirExpression(this) }
}
FirFunctionCallImpl(null).apply {
calleeReference = FirSimpleNamedReference(null, conventionCallName, null)
explicitReceiver = getAsFirExpression(argument, "No operand")
}
}
} else {
val firOperation = operationToken.toFirOperation()
FirOperatorCallImpl(null, firOperation).apply {
arguments += getAsFirExpression<FirExpression>(argument, "No operand")
else -> {
val firOperation = operationToken.toFirOperation()
FirOperatorCallImpl(null, firOperation).apply {
arguments += getAsFirExpression<FirExpression>(argument, "No operand")
}
}
}
}