@@ -606,6 +606,11 @@ open class KotlinFileExtractor(
606606 return true
607607 }
608608
609+ fun isNumericFunction (fName : String ): Boolean {
610+ return isFunction(" kotlin" , " Int" , fName) ||
611+ isFunction(" kotlin" , " Double" , fName)
612+ }
613+
609614 fun binopDisp (id : Label <out DbExpr >) {
610615 val locId = tw.getLocation(c)
611616 tw.writeHasLocation(id, locId)
@@ -635,25 +640,25 @@ open class KotlinFileExtractor(
635640 val dr = c.dispatchReceiver
636641 when {
637642 c.origin == IrStatementOrigin .PLUS &&
638- (isFunction( " kotlin " , " Int " , " plus" ) || isFunction(" kotlin" , " String" , " plus" )) -> {
643+ (isNumericFunction( " plus" ) || isFunction(" kotlin" , " String" , " plus" )) -> {
639644 val id = tw.getFreshIdLabel<DbAddexpr >()
640645 val type = useType(c.type)
641646 tw.writeExprs_addexpr(id, type.javaResult.id, type.kotlinResult.id, parent, idx)
642647 binopDisp(id)
643648 }
644- c.origin == IrStatementOrigin .MINUS && isFunction( " kotlin " , " Int " , " minus" ) -> {
649+ c.origin == IrStatementOrigin .MINUS && isNumericFunction( " minus" ) -> {
645650 val id = tw.getFreshIdLabel<DbSubexpr >()
646651 val type = useType(c.type)
647652 tw.writeExprs_subexpr(id, type.javaResult.id, type.kotlinResult.id, parent, idx)
648653 binopDisp(id)
649654 }
650- c.origin == IrStatementOrigin .DIV && isFunction( " kotlin " , " Int " , " div" ) -> {
655+ c.origin == IrStatementOrigin .DIV && isNumericFunction( " div" ) -> {
651656 val id = tw.getFreshIdLabel<DbDivexpr >()
652657 val type = useType(c.type)
653658 tw.writeExprs_divexpr(id, type.javaResult.id, type.kotlinResult.id, parent, idx)
654659 binopDisp(id)
655660 }
656- c.origin == IrStatementOrigin .PERC && isFunction( " kotlin " , " Int " , " rem" ) -> {
661+ c.origin == IrStatementOrigin .PERC && isNumericFunction( " rem" ) -> {
657662 val id = tw.getFreshIdLabel<DbRemexpr >()
658663 val type = useType(c.type)
659664 tw.writeExprs_remexpr(id, type.javaResult.id, type.kotlinResult.id, parent, idx)
@@ -1456,4 +1461,4 @@ open class KotlinFileExtractor(
14561461
14571462 private val IrType .isAnonymous: Boolean
14581463 get() = ((this as ? IrSimpleType )?.classifier?.owner as ? IrClass )?.isAnonymousObject ? : false
1459- }
1464+ }
0 commit comments