Skip to content

Commit ffc7e6b

Browse files
committed
Extract bit not expression
1 parent 54b210f commit ffc7e6b

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,6 +2030,13 @@ open class KotlinFileExtractor(
20302030
tw.writeExprsKotlinType(id, type.kotlinResult.id)
20312031
unaryopDisp(id)
20322032
}
2033+
isNumericFunction(target, "inv") -> {
2034+
val id = tw.getFreshIdLabel<DbBitnotexpr>()
2035+
val type = useType(c.type)
2036+
tw.writeExprs_bitnotexpr(id, type.javaResult.id, parent, idx)
2037+
tw.writeExprsKotlinType(id, type.kotlinResult.id)
2038+
unaryopDisp(id)
2039+
}
20332040
// We need to handle all the builtin operators defines in BuiltInOperatorNames in
20342041
// compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrBuiltIns.kt
20352042
// as they can't be extracted as external dependencies.

java/ql/test/kotlin/library-tests/exprs/CONSISTENCY/javaEquivalent.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
| file://:0:0:0:0 | Couldn't find a Java equivalent function to kotlin.Byte.toInt in java.lang.Byte |
1212
| file://:0:0:0:0 | Couldn't find a Java equivalent function to kotlin.Byte.toInt in java.lang.Byte |
1313
| file://:0:0:0:0 | Couldn't find a Java equivalent function to kotlin.Int.dec in java.lang.Integer |
14-
| file://:0:0:0:0 | Couldn't find a Java equivalent function to kotlin.Int.inv in java.lang.Integer |
1514
| file://:0:0:0:0 | Couldn't find a Java equivalent function to kotlin.Int.rangeTo in java.lang.Integer |
1615
| file://:0:0:0:0 | Couldn't find a Java equivalent function to kotlin.Int.rangeTo in java.lang.Integer |
17-
| file://:0:0:0:0 | Couldn't find a Java equivalent function to kotlin.Long.inv in java.lang.Long |
1816
| file://:0:0:0:0 | Couldn't find a Java equivalent function to kotlin.Short.toInt in java.lang.Short |
1917
| file://:0:0:0:0 | Couldn't find a Java equivalent function to kotlin.Short.toInt in java.lang.Short |
2018
| file://:0:0:0:0 | Couldn't find a Java equivalent function to kotlin.Short.toInt in java.lang.Short |

java/ql/test/kotlin/library-tests/exprs/PrintAst.expected

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,8 +1974,8 @@ exprs.kt:
19741974
# 21| 1: [VarAccess] y
19751975
# 22| 11: [LocalVariableDeclStmt] var ...;
19761976
# 22| 1: [LocalVariableDeclExpr] i12
1977-
# 22| 0: [MethodAccess] inv(...)
1978-
# 22| -1: [VarAccess] x
1977+
# 22| 0: [BitNotExpr] ~...
1978+
# 22| 0: [VarAccess] x
19791979
# 23| 12: [LocalVariableDeclStmt] var ...;
19801980
# 23| 1: [LocalVariableDeclExpr] i13
19811981
# 23| 0: [ValueEQExpr] ... (value equals) ...
@@ -2236,8 +2236,8 @@ exprs.kt:
22362236
# 72| 1: [VarAccess] ly
22372237
# 73| 59: [LocalVariableDeclStmt] var ...;
22382238
# 73| 1: [LocalVariableDeclExpr] l12
2239-
# 73| 0: [MethodAccess] inv(...)
2240-
# 73| -1: [VarAccess] lx
2239+
# 73| 0: [BitNotExpr] ~...
2240+
# 73| 0: [VarAccess] lx
22412241
# 74| 60: [LocalVariableDeclStmt] var ...;
22422242
# 74| 1: [LocalVariableDeclExpr] l13
22432243
# 74| 0: [ValueEQExpr] ... (value equals) ...

java/ql/test/kotlin/library-tests/exprs/exprs.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@
948948
| exprs.kt:21:21:21:21 | y | exprs.kt:4:1:136:1 | topLevelMethod | VarAccess |
949949
| exprs.kt:22:5:22:21 | i12 | exprs.kt:4:1:136:1 | topLevelMethod | LocalVariableDeclExpr |
950950
| exprs.kt:22:15:22:15 | x | exprs.kt:4:1:136:1 | topLevelMethod | VarAccess |
951-
| exprs.kt:22:17:22:21 | inv(...) | exprs.kt:4:1:136:1 | topLevelMethod | MethodAccess |
951+
| exprs.kt:22:17:22:21 | ~... | exprs.kt:4:1:136:1 | topLevelMethod | BitNotExpr |
952952
| exprs.kt:23:5:23:20 | i13 | exprs.kt:4:1:136:1 | topLevelMethod | LocalVariableDeclExpr |
953953
| exprs.kt:23:15:23:15 | x | exprs.kt:4:1:136:1 | topLevelMethod | VarAccess |
954954
| exprs.kt:23:15:23:20 | ... (value equals) ... | exprs.kt:4:1:136:1 | topLevelMethod | ValueEQExpr |
@@ -1162,7 +1162,7 @@
11621162
| exprs.kt:72:22:72:23 | ly | exprs.kt:4:1:136:1 | topLevelMethod | VarAccess |
11631163
| exprs.kt:73:5:73:22 | l12 | exprs.kt:4:1:136:1 | topLevelMethod | LocalVariableDeclExpr |
11641164
| exprs.kt:73:15:73:16 | lx | exprs.kt:4:1:136:1 | topLevelMethod | VarAccess |
1165-
| exprs.kt:73:18:73:22 | inv(...) | exprs.kt:4:1:136:1 | topLevelMethod | MethodAccess |
1165+
| exprs.kt:73:18:73:22 | ~... | exprs.kt:4:1:136:1 | topLevelMethod | BitNotExpr |
11661166
| exprs.kt:74:5:74:22 | l13 | exprs.kt:4:1:136:1 | topLevelMethod | LocalVariableDeclExpr |
11671167
| exprs.kt:74:15:74:16 | lx | exprs.kt:4:1:136:1 | topLevelMethod | VarAccess |
11681168
| exprs.kt:74:15:74:22 | ... (value equals) ... | exprs.kt:4:1:136:1 | topLevelMethod | ValueEQExpr |

java/ql/test/kotlin/library-tests/exprs/unaryOp.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
| exprs.kt:22:17:22:21 | ~... | exprs.kt:22:15:22:15 | x |
12
| exprs.kt:32:15:32:26 | !... | exprs.kt:32:15:32:26 | contains(...) |
3+
| exprs.kt:73:18:73:22 | ~... | exprs.kt:73:15:73:16 | lx |
24
| exprs.kt:115:14:115:16 | !... | exprs.kt:115:15:115:16 | b1 |
35
| exprs.kt:196:19:196:20 | ...!! | exprs.kt:196:18:196:18 | x |
46
| exprs.kt:205:20:205:21 | ...!! | exprs.kt:205:19:205:19 | s |

0 commit comments

Comments
 (0)