@@ -257,13 +257,14 @@ private fun KaFunctionSymbol.hasName(
257
257
)
258
258
}
259
259
260
- private fun KaFunctionSymbol.isNumericWithName (functionName : String ): Boolean {
261
- return 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)
260
+ private fun KaFunctionSymbol?.isNumericWithName (functionName : String ): Boolean {
261
+ return this != null &&
262
+ (this .hasName(" kotlin" , " Int" , functionName) ||
263
+ this .hasName(" kotlin" , " Byte" , functionName) ||
264
+ this .hasName(" kotlin" , " Short" , functionName) ||
265
+ this .hasName(" kotlin" , " Long" , functionName) ||
266
+ this .hasName(" kotlin" , " Float" , functionName) ||
267
+ this .hasName(" kotlin" , " Double" , functionName))
267
268
}
268
269
269
270
/* *
@@ -291,10 +292,6 @@ private fun KotlinFileExtractor.extractBinaryExpression(
291
292
val op = expression.operationToken as ? KtToken
292
293
val target = ((expression.resolveToCall() as ? KaSuccessCallInfo )?.call as ? KaSimpleFunctionCall )?.symbol
293
294
294
- if (target == null ) {
295
- TODO ()
296
- }
297
-
298
295
if (op == KtTokens .PLUS && target.isBinaryPlus()) {
299
296
extractBinaryExpression(expression, callable, parent, tw::writeExprs_addexpr)
300
297
} else if (op == KtTokens .MINUS && target.isNumericWithName(" minus" )) {
@@ -317,19 +314,24 @@ private fun KotlinFileExtractor.extractBinaryExpression(
317
314
extractBinaryExpression(expression, callable, parent, tw::writeExprs_rshiftexpr)
318
315
} else if (op == KtTokens .IDENTIFIER && target.isNumericWithName(" ushr" )) {
319
316
extractBinaryExpression(expression, callable, parent, tw::writeExprs_urshiftexpr)
317
+ } else if (op == KtTokens .EQEQEQ && target == null ) {
318
+ extractBinaryExpression(expression, callable, parent, tw::writeExprs_eqexpr)
319
+ } else if (op == KtTokens .EXCLEQEQEQ && target == null ) {
320
+ extractBinaryExpression(expression, callable, parent, tw::writeExprs_neexpr)
320
321
} else {
321
322
TODO (" Extract as method call" )
322
323
}
323
324
}
324
325
325
- private fun KaFunctionSymbol.isBinaryPlus (): Boolean {
326
- return this .isNumericWithName(" plus" ) ||
327
- this .hasName(" kotlin" , " String" , " plus" ) ||
328
- this .hasMatchingNames(
329
- CallableId (FqName (" kotlin" ), null , Name .identifier(" plus" )),
330
- ClassId (FqName (" kotlin" ), Name .identifier(" String" )),
331
- nullability = KaTypeNullability .NULLABLE ,
332
- )
326
+ private fun KaFunctionSymbol?.isBinaryPlus (): Boolean {
327
+ return this != null && (
328
+ this .isNumericWithName(" plus" ) ||
329
+ this .hasName(" kotlin" , " String" , " plus" ) ||
330
+ this .hasMatchingNames(
331
+ CallableId (FqName (" kotlin" ), null , Name .identifier(" plus" )),
332
+ ClassId (FqName (" kotlin" ), Name .identifier(" String" )),
333
+ nullability = KaTypeNullability .NULLABLE ,
334
+ ))
333
335
}
334
336
335
337
context(KaSession )
0 commit comments