@@ -1367,7 +1367,9 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1367
1367
substituteStaticFields(statics, isParametrized = true )
1368
1368
1369
1369
// build this instance
1370
- thisInstance = genericExecution.stateBefore.thisInstance?.let { currentMethodParameters[CgParameterKind .ThisInstance ] }
1370
+ thisInstance = genericExecution.stateBefore.thisInstance?.let {
1371
+ variableConstructor.getOrCreateVariable(it)
1372
+ }
1371
1373
1372
1374
// build arguments for method under test and parameterized test
1373
1375
for (index in genericExecution.stateBefore.parameters.indices) {
@@ -1429,20 +1431,6 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1429
1431
val executableUnderTestParameters = testSet.executableId.executable.parameters
1430
1432
1431
1433
return mutableListOf<CgParameterDeclaration >().apply {
1432
- // this instance
1433
- val thisInstanceModel = genericExecution.stateBefore.thisInstance
1434
- if (thisInstanceModel != null ) {
1435
- val type = wrapTypeIfRequired(thisInstanceModel.classId)
1436
- val thisInstance = CgParameterDeclaration (
1437
- parameter = declareParameter(
1438
- type = type,
1439
- name = nameGenerator.variableName(type)
1440
- ),
1441
- isReferenceType = true
1442
- )
1443
- this + = thisInstance
1444
- currentMethodParameters[CgParameterKind .ThisInstance ] = thisInstance.parameter
1445
- }
1446
1434
// arguments
1447
1435
for (index in genericExecution.stateBefore.parameters.indices) {
1448
1436
val argumentName = paramNames[executableUnderTest]?.get(index)
@@ -1554,9 +1542,6 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1554
1542
1555
1543
private fun createExecutionArguments (testSet : CgMethodTestSet , execution : UtExecution ): List <CgExpression > {
1556
1544
val arguments = mutableListOf<CgExpression >()
1557
- execution.stateBefore.thisInstance?.let {
1558
- arguments + = variableConstructor.getOrCreateVariable(it)
1559
- }
1560
1545
1561
1546
for ((paramIndex, paramModel) in execution.stateBefore.parameters.withIndex()) {
1562
1547
val argumentName = paramNames[testSet.executableId]?.get(paramIndex)
0 commit comments