@@ -1367,7 +1367,9 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
13671367 substituteStaticFields(statics, isParametrized = true )
13681368
13691369 // build this instance
1370- thisInstance = genericExecution.stateBefore.thisInstance?.let { currentMethodParameters[CgParameterKind .ThisInstance ] }
1370+ thisInstance = genericExecution.stateBefore.thisInstance?.let {
1371+ variableConstructor.getOrCreateVariable(it)
1372+ }
13711373
13721374 // build arguments for method under test and parameterized test
13731375 for (index in genericExecution.stateBefore.parameters.indices) {
@@ -1429,20 +1431,6 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
14291431 val executableUnderTestParameters = testSet.executableId.executable.parameters
14301432
14311433 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- }
14461434 // arguments
14471435 for (index in genericExecution.stateBefore.parameters.indices) {
14481436 val argumentName = paramNames[executableUnderTest]?.get(index)
@@ -1554,9 +1542,6 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
15541542
15551543 private fun createExecutionArguments (testSet : CgMethodTestSet , execution : UtExecution ): List <CgExpression > {
15561544 val arguments = mutableListOf<CgExpression >()
1557- execution.stateBefore.thisInstance?.let {
1558- arguments + = variableConstructor.getOrCreateVariable(it)
1559- }
15601545
15611546 for ((paramIndex, paramModel) in execution.stateBefore.parameters.withIndex()) {
15621547 val argumentName = paramNames[testSet.executableId]?.get(paramIndex)
0 commit comments