Skip to content

Commit

Permalink
Preserve identity when mapping MissingState
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaMuravjov authored and EgorkaKulikov committed Dec 22, 2023
1 parent c89b3b2 commit 8831369
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.utbot.framework.plugin.api.mapper

import org.utbot.framework.plugin.api.EnvironmentModels
import org.utbot.framework.plugin.api.MissingState
import org.utbot.framework.plugin.api.UtDirectGetFieldModel
import org.utbot.framework.plugin.api.UtDirectSetFieldModel
import org.utbot.framework.plugin.api.UtExecutableCallModel
Expand Down Expand Up @@ -50,12 +51,15 @@ fun UtStatementCallModel.mapModels(mapper: UtModelMapper): UtStatementCallModel
)
}

fun EnvironmentModels.mapModels(mapper: UtModelMapper) = EnvironmentModels(
thisInstance = thisInstance?.map(mapper),
statics = statics.mapModelValues(mapper),
parameters = parameters.mapModels(mapper),
executableToCall = executableToCall,
)
fun EnvironmentModels.mapModels(mapper: UtModelMapper) = when (this) {
MissingState -> MissingState
else -> EnvironmentModels(
thisInstance = thisInstance?.map(mapper),
statics = statics.mapModelValues(mapper),
parameters = parameters.mapModels(mapper),
executableToCall = executableToCall,
)
}

fun UtExecutionResult.mapModelIfExists(mapper: UtModelMapper) = if (this.isSuccess) {
val successResult = this as UtExecutionSuccess
Expand Down

0 comments on commit 8831369

Please sign in to comment.