@@ -256,13 +256,14 @@ private fun KaFunctionSymbol.hasName(
256
256
)
257
257
}
258
258
259
- private fun KaFunctionSymbol.isNumericWithName (functionName : String ): Boolean {
260
- return this .hasName(" kotlin" , " Int" , functionName) ||
261
- this .hasName(" kotlin" , " Byte" , functionName) ||
262
- this .hasName(" kotlin" , " Short" , functionName) ||
263
- this .hasName(" kotlin" , " Long" , functionName) ||
264
- this .hasName(" kotlin" , " Float" , functionName) ||
265
- this .hasName(" kotlin" , " Double" , functionName)
259
+ private fun KaFunctionSymbol?.isNumericWithName (functionName : String ): Boolean {
260
+ return this != null &&
261
+ (this .hasName(" kotlin" , " Int" , functionName) ||
262
+ this .hasName(" kotlin" , " Byte" , functionName) ||
263
+ this .hasName(" kotlin" , " Short" , functionName) ||
264
+ this .hasName(" kotlin" , " Long" , functionName) ||
265
+ this .hasName(" kotlin" , " Float" , functionName) ||
266
+ this .hasName(" kotlin" , " Double" , functionName))
266
267
}
267
268
268
269
context(KaSession )
@@ -297,10 +298,6 @@ private fun KotlinFileExtractor.extractBinaryExpression(
297
298
val op = expression.operationToken
298
299
val target = expression.resolveCallTarget()?.symbol
299
300
300
- if (target == null ) {
301
- TODO ()
302
- }
303
-
304
301
if (op == KtTokens .PLUS && target.isBinaryPlus()) {
305
302
extractBinaryExpression(expression, callable, parent, tw::writeExprs_addexpr)
306
303
} else if (op == KtTokens .MINUS && target.isNumericWithName(" minus" )) {
@@ -323,19 +320,24 @@ private fun KotlinFileExtractor.extractBinaryExpression(
323
320
extractBinaryExpression(expression, callable, parent, tw::writeExprs_rshiftexpr)
324
321
} else if (op == KtTokens .IDENTIFIER && target.isNumericWithName(" ushr" )) {
325
322
extractBinaryExpression(expression, callable, parent, tw::writeExprs_urshiftexpr)
323
+ } else if (op == KtTokens .EQEQEQ && target == null ) {
324
+ extractBinaryExpression(expression, callable, parent, tw::writeExprs_eqexpr)
325
+ } else if (op == KtTokens .EXCLEQEQEQ && target == null ) {
326
+ extractBinaryExpression(expression, callable, parent, tw::writeExprs_neexpr)
326
327
} else {
327
328
TODO (" Extract as method call" )
328
329
}
329
330
}
330
331
331
- private fun KaFunctionSymbol.isBinaryPlus (): Boolean {
332
- return this .isNumericWithName(" plus" ) ||
333
- this .hasName(" kotlin" , " String" , " plus" ) ||
334
- this .hasMatchingNames(
335
- CallableId (FqName (" kotlin" ), null , Name .identifier(" plus" )),
336
- ClassId (FqName (" kotlin" ), Name .identifier(" String" )),
337
- nullability = KaTypeNullability .NULLABLE ,
338
- )
332
+ private fun KaFunctionSymbol?.isBinaryPlus (): Boolean {
333
+ return this != null && (
334
+ this .isNumericWithName(" plus" ) ||
335
+ this .hasName(" kotlin" , " String" , " plus" ) ||
336
+ this .hasMatchingNames(
337
+ CallableId (FqName (" kotlin" ), null , Name .identifier(" plus" )),
338
+ ClassId (FqName (" kotlin" ), Name .identifier(" String" )),
339
+ nullability = KaTypeNullability .NULLABLE ,
340
+ ))
339
341
}
340
342
341
343
context(KaSession )
0 commit comments