IrBuiltIns: factoring out operator names
so that they can be used in other contexts.
This commit is contained in:
committed by
max-kammerer
parent
8021f9c4af
commit
f352a4dcd4
@@ -180,24 +180,24 @@ class IrBuiltIns(
|
|||||||
val primitiveTypesWithComparisons = listOf(int, long, float, double)
|
val primitiveTypesWithComparisons = listOf(int, long, float, double)
|
||||||
val primitiveFloatingPointTypes = listOf(float, double)
|
val primitiveFloatingPointTypes = listOf(float, double)
|
||||||
|
|
||||||
val lessFunByOperandType = primitiveTypesWithComparisons.defineComparisonOperatorForEachType("less")
|
val lessFunByOperandType = primitiveTypesWithComparisons.defineComparisonOperatorForEachType(OperatorNames.LESS)
|
||||||
val lessOrEqualFunByOperandType = primitiveTypesWithComparisons.defineComparisonOperatorForEachType("lessOrEqual")
|
val lessOrEqualFunByOperandType = primitiveTypesWithComparisons.defineComparisonOperatorForEachType(OperatorNames.LESS_OR_EQUAL)
|
||||||
val greaterOrEqualFunByOperandType = primitiveTypesWithComparisons.defineComparisonOperatorForEachType("greaterOrEqual")
|
val greaterOrEqualFunByOperandType = primitiveTypesWithComparisons.defineComparisonOperatorForEachType(OperatorNames.GREATER_OR_EQUAL)
|
||||||
val greaterFunByOperandType = primitiveTypesWithComparisons.defineComparisonOperatorForEachType("greater")
|
val greaterFunByOperandType = primitiveTypesWithComparisons.defineComparisonOperatorForEachType(OperatorNames.GREATER)
|
||||||
|
|
||||||
val ieee754equalsFunByOperandType =
|
val ieee754equalsFunByOperandType =
|
||||||
primitiveFloatingPointTypes.associate {
|
primitiveFloatingPointTypes.associate {
|
||||||
it to defineOperator("ieee754equals", bool, listOf(it.makeNullable(), it.makeNullable()))
|
it to defineOperator(OperatorNames.IEEE754_EQUALS, bool, listOf(it.makeNullable(), it.makeNullable()))
|
||||||
}
|
}
|
||||||
|
|
||||||
val eqeqeqFun = defineOperator("EQEQEQ", bool, listOf(anyN, anyN))
|
val eqeqeqFun = defineOperator(OperatorNames.EQEQEQ, bool, listOf(anyN, anyN))
|
||||||
val eqeqFun = defineOperator("EQEQ", bool, listOf(anyN, anyN))
|
val eqeqFun = defineOperator(OperatorNames.EQEQ, bool, listOf(anyN, anyN))
|
||||||
val throwNpeFun = defineOperator("THROW_NPE", nothing, listOf())
|
val throwNpeFun = defineOperator(OperatorNames.THROW_NPE, nothing, listOf())
|
||||||
val throwCceFun = defineOperator("THROW_CCE", nothing, listOf())
|
val throwCceFun = defineOperator(OperatorNames.THROW_CCE, nothing, listOf())
|
||||||
val throwIseFun = defineOperator("THROW_ISE", nothing, listOf())
|
val throwIseFun = defineOperator(OperatorNames.THROW_ISE, nothing, listOf())
|
||||||
val booleanNotFun = defineOperator("NOT", bool, listOf(bool))
|
val booleanNotFun = defineOperator(OperatorNames.NOT, bool, listOf(bool))
|
||||||
val noWhenBranchMatchedExceptionFun = defineOperator("noWhenBranchMatchedException", nothing, listOf())
|
val noWhenBranchMatchedExceptionFun = defineOperator(OperatorNames.NO_WHEN_BRANCH_MATCHED_EXCEPTION, nothing, listOf())
|
||||||
val illegalArgumentExceptionFun = defineOperator("illegalArgumentException", nothing, listOf(string))
|
val illegalArgumentExceptionFun = defineOperator(OperatorNames.ILLEGAL_ARGUMENT_EXCEPTION, nothing, listOf(string))
|
||||||
|
|
||||||
val eqeqeq = eqeqeqFun.descriptor
|
val eqeqeq = eqeqeqFun.descriptor
|
||||||
val eqeq = eqeqFun.descriptor
|
val eqeq = eqeqFun.descriptor
|
||||||
@@ -253,4 +253,20 @@ class IrBuiltIns(
|
|||||||
companion object {
|
companion object {
|
||||||
val KOTLIN_INTERNAL_IR_FQN = FqName("kotlin.internal.ir")
|
val KOTLIN_INTERNAL_IR_FQN = FqName("kotlin.internal.ir")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object OperatorNames {
|
||||||
|
const val LESS = "less"
|
||||||
|
const val LESS_OR_EQUAL = "lessOrEqual"
|
||||||
|
const val GREATER = "greater"
|
||||||
|
const val GREATER_OR_EQUAL = "greaterOrEqual"
|
||||||
|
const val EQEQ = "EQEQ"
|
||||||
|
const val EQEQEQ = "EQEQEQ"
|
||||||
|
const val IEEE754_EQUALS = "ieee754equals"
|
||||||
|
const val NOT = "NOT"
|
||||||
|
const val THROW_NPE = "THROW_NPE"
|
||||||
|
const val THROW_CCE = "THROW_CCE"
|
||||||
|
const val THROW_ISE = "THROW_ISE"
|
||||||
|
const val NO_WHEN_BRANCH_MATCHED_EXCEPTION = "noWhenBranchMatchedException"
|
||||||
|
const val ILLEGAL_ARGUMENT_EXCEPTION = "illegalArgumentException "
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user