@@ -1337,7 +1337,9 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1337
1337
substituteStaticFields(statics, isParametrized = true )
1338
1338
1339
1339
// build this instance
1340
- thisInstance = genericExecution.stateBefore.thisInstance?.let { currentMethodParameters[CgParameterKind .ThisInstance ] }
1340
+ thisInstance = genericExecution.stateBefore.thisInstance?.let {
1341
+ variableConstructor.getOrCreateVariable(it)
1342
+ }
1341
1343
1342
1344
// build arguments for method under test and parameterized test
1343
1345
for (index in genericExecution.stateBefore.parameters.indices) {
@@ -1399,20 +1401,6 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1399
1401
val executableUnderTestParameters = testSet.executableId.executable.parameters
1400
1402
1401
1403
return mutableListOf<CgParameterDeclaration >().apply {
1402
- // this instance
1403
- val thisInstanceModel = genericExecution.stateBefore.thisInstance
1404
- if (thisInstanceModel != null ) {
1405
- val type = wrapTypeIfRequired(thisInstanceModel.classId)
1406
- val thisInstance = CgParameterDeclaration (
1407
- parameter = declareParameter(
1408
- type = type,
1409
- name = nameGenerator.variableName(type)
1410
- ),
1411
- isReferenceType = true
1412
- )
1413
- this + = thisInstance
1414
- currentMethodParameters[CgParameterKind .ThisInstance ] = thisInstance.parameter
1415
- }
1416
1404
// arguments
1417
1405
for (index in genericExecution.stateBefore.parameters.indices) {
1418
1406
val argumentName = paramNames[executableUnderTest]?.get(index)
@@ -1524,9 +1512,6 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
1524
1512
1525
1513
private fun createExecutionArguments (testSet : CgMethodTestSet , execution : UtExecution ): List <CgExpression > {
1526
1514
val arguments = mutableListOf<CgExpression >()
1527
- execution.stateBefore.thisInstance?.let {
1528
- arguments + = variableConstructor.getOrCreateVariable(it)
1529
- }
1530
1515
1531
1516
for ((paramIndex, paramModel) in execution.stateBefore.parameters.withIndex()) {
1532
1517
val argumentName = paramNames[testSet.executableId]?.get(paramIndex)
0 commit comments