@@ -2926,7 +2926,11 @@ open class KotlinFileExtractor(
2926
2926
tw.writeStmts_throwstmt(throwId, stmtParent.parent, stmtParent.idx, callable)
2927
2927
tw.writeHasLocation(throwId, locId)
2928
2928
val newExprId = extractNewExpr(it, null , thrownType, locId, throwId, 0 , callable, throwId)
2929
- extractTypeAccess(thrownType, locId, newExprId, - 3 , callable, throwId)
2929
+ if (newExprId == null ) {
2930
+ logger.errorElement(" No ID for newExpr in noWhenBranchMatchedException" , c)
2931
+ } else {
2932
+ extractTypeAccess(thrownType, locId, newExprId, - 3 , callable, throwId)
2933
+ }
2930
2934
}
2931
2935
}
2932
2936
isBuiltinCallInternal(c, " illegalArgumentException" ) -> {
@@ -3270,7 +3274,7 @@ open class KotlinFileExtractor(
3270
3274
idx : Int ,
3271
3275
callable : Label <out DbCallable >,
3272
3276
enclosingStmt : Label <out DbStmt >
3273
- ): Label <DbNewexpr > = extractNewExpr(useFunction<DbConstructor >(calledConstructor, constructorTypeArgs), constructedType, locId, parent, idx, callable, enclosingStmt)
3277
+ ): Label <DbNewexpr >? = extractNewExpr(useFunction<DbConstructor >(calledConstructor, constructorTypeArgs), constructedType, locId, parent, idx, callable, enclosingStmt)
3274
3278
3275
3279
private fun needsObinitFunction (c : IrClass ) = c.primaryConstructor == null && c.constructors.count() > 1
3276
3280
@@ -3310,26 +3314,31 @@ open class KotlinFileExtractor(
3310
3314
extractDefaultsCallArguments(it, e.symbol.owner, callable, enclosingStmt, valueArgs, null , null )
3311
3315
}
3312
3316
} else {
3313
- extractNewExpr(e.symbol.owner, eType.arguments, type, locId, parent, idx, callable, enclosingStmt).also {
3314
-
3315
- val realCallTarget = e.symbol.owner.realOverrideTarget
3316
- // Generated constructor calls to kotlin.Enum have no arguments in IR, but the constructor takes two parameters.
3317
- if (e is IrEnumConstructorCall &&
3318
- realCallTarget is IrConstructor &&
3319
- realCallTarget.parentClassOrNull?.fqNameWhenAvailable?.asString() == " kotlin.Enum" &&
3320
- realCallTarget.valueParameters.size == 2 &&
3321
- realCallTarget.valueParameters[0 ].type == pluginContext.irBuiltIns.stringType &&
3322
- realCallTarget.valueParameters[1 ].type == pluginContext.irBuiltIns.intType) {
3323
-
3324
- val id0 = extractNull(pluginContext.irBuiltIns.stringType, locId, it, 0 , callable, enclosingStmt)
3325
- tw.writeCompiler_generated(id0, CompilerGeneratedKinds .ENUM_CONSTRUCTOR_ARGUMENT .kind)
3326
-
3327
- val id1 = extractConstantInteger(0 , locId, it, 1 , callable, enclosingStmt)
3328
- tw.writeCompiler_generated(id1, CompilerGeneratedKinds .ENUM_CONSTRUCTOR_ARGUMENT .kind)
3329
- } else {
3330
- extractCallValueArguments(it, e, enclosingStmt, callable, 0 )
3331
- }
3317
+ val newExprId = extractNewExpr(e.symbol.owner, eType.arguments, type, locId, parent, idx, callable, enclosingStmt)
3318
+ if (newExprId == null ) {
3319
+ logger.errorElement(" Cannot get newExpr ID" , e)
3320
+ return
3332
3321
}
3322
+
3323
+ val realCallTarget = e.symbol.owner.realOverrideTarget
3324
+ // Generated constructor calls to kotlin.Enum have no arguments in IR, but the constructor takes two parameters.
3325
+ if (e is IrEnumConstructorCall &&
3326
+ realCallTarget is IrConstructor &&
3327
+ realCallTarget.parentClassOrNull?.fqNameWhenAvailable?.asString() == " kotlin.Enum" &&
3328
+ realCallTarget.valueParameters.size == 2 &&
3329
+ realCallTarget.valueParameters[0 ].type == pluginContext.irBuiltIns.stringType &&
3330
+ realCallTarget.valueParameters[1 ].type == pluginContext.irBuiltIns.intType) {
3331
+
3332
+ val id0 = extractNull(pluginContext.irBuiltIns.stringType, locId, newExprId, 0 , callable, enclosingStmt)
3333
+ tw.writeCompiler_generated(id0, CompilerGeneratedKinds .ENUM_CONSTRUCTOR_ARGUMENT .kind)
3334
+
3335
+ val id1 = extractConstantInteger(0 , locId, newExprId, 1 , callable, enclosingStmt)
3336
+ tw.writeCompiler_generated(id1, CompilerGeneratedKinds .ENUM_CONSTRUCTOR_ARGUMENT .kind)
3337
+ } else {
3338
+ extractCallValueArguments(newExprId, e, enclosingStmt, callable, 0 )
3339
+ }
3340
+
3341
+ newExprId
3333
3342
}
3334
3343
3335
3344
if (isAnonymous) {
0 commit comments