[JS IR] Type operator call pureness
This commit is contained in:
@@ -661,6 +661,12 @@ fun IrExpression?.isPure(
|
|||||||
if (valueDeclaration is IrVariable) !valueDeclaration.isVar
|
if (valueDeclaration is IrVariable) !valueDeclaration.isVar
|
||||||
else true
|
else true
|
||||||
}
|
}
|
||||||
|
is IrTypeOperatorCall ->
|
||||||
|
(
|
||||||
|
operator == IrTypeOperator.INSTANCEOF ||
|
||||||
|
operator == IrTypeOperator.REINTERPRET_CAST ||
|
||||||
|
operator == IrTypeOperator.NOT_INSTANCEOF
|
||||||
|
) && argument.isPure(anyVariable, checkFields, context)
|
||||||
is IrCall -> if (context?.isSideEffectFree(this) == true) {
|
is IrCall -> if (context?.isSideEffectFree(this) == true) {
|
||||||
for (i in 0 until valueArgumentsCount) {
|
for (i in 0 until valueArgumentsCount) {
|
||||||
val valueArgument = getValueArgument(i)
|
val valueArgument = getValueArgument(i)
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ class JsIrBackendContext(
|
|||||||
|
|
||||||
override fun isSideEffectFree(call: IrCall): Boolean =
|
override fun isSideEffectFree(call: IrCall): Boolean =
|
||||||
call.symbol in intrinsics.primitiveToLiteralConstructor.values ||
|
call.symbol in intrinsics.primitiveToLiteralConstructor.values ||
|
||||||
call.symbol == intrinsics.arrayLiteral
|
call.symbol == intrinsics.arrayLiteral ||
|
||||||
|
call.symbol == intrinsics.arrayConcat
|
||||||
|
|
||||||
val devMode = configuration[JSConfigurationKeys.DEVELOPER_MODE] ?: false
|
val devMode = configuration[JSConfigurationKeys.DEVELOPER_MODE] ?: false
|
||||||
val errorPolicy = configuration[JSConfigurationKeys.ERROR_TOLERANCE_POLICY] ?: ErrorTolerancePolicy.DEFAULT
|
val errorPolicy = configuration[JSConfigurationKeys.ERROR_TOLERANCE_POLICY] ?: ErrorTolerancePolicy.DEFAULT
|
||||||
|
|||||||
Reference in New Issue
Block a user