@@ -587,12 +587,12 @@ class UtBotSymbolicEngine(
587
587
/* *
588
588
* Construct sequence of [ExecutionState] that's initialized by fuzzing.
589
589
*/
590
- private fun statesInitializedFromFuzzing (state : ExecutionState , hasThis : Boolean ): Sequence <ExecutionState > =
590
+ private fun statesInitializedFromFuzzing (state : ExecutionState ): Sequence <ExecutionState > =
591
591
withEnvironmentState(state) {
592
592
fuzzInitialModels(::getModelProviderToFuzzingInitializing, FallbackModelProvider { nextDefaultModelId++ })
593
593
.map { parameters ->
594
594
withIsolatedUpdates {
595
- val stateParametersWithoutThis = if (hasThis ) {
595
+ val stateParametersWithoutThis = if (methodUnderTest.hasThisInParameters ) {
596
596
state.parameters.drop(1 )
597
597
} else {
598
598
state.parameters
@@ -1321,32 +1321,33 @@ class UtBotSymbolicEngine(
1321
1321
1322
1322
environment.state.parameters + = Parameter (localVariable, identityRef.type, value)
1323
1323
1324
- var nextState = environment.state.updateQueued(
1324
+ val nextState = environment.state.updateQueued(
1325
1325
globalGraph.succ(current),
1326
1326
SymbolicStateUpdate (localMemoryUpdates = localMemoryUpdate(localVariable to value))
1327
1327
)
1328
1328
// TODO: refactor this
1329
- if (UtSettings .useFuzzingInitialization && ! isInNestedMethod()) {
1330
- val hasThis = methodUnderTest.run {
1331
- ! isStatic && ! isConstructor
1332
- }
1329
+ val initializedStateByFuzzing = if (UtSettings .useFuzzingInitialization && ! isInNestedMethod()) {
1333
1330
var expectedParamsSize = if (methodUnderTest.isConstructor) {
1334
1331
methodUnderTest.javaConstructor!! .parameterCount
1335
1332
} else {
1336
1333
methodUnderTest.javaMethod!! .parameterCount
1337
1334
}
1338
- if (hasThis ) {
1335
+ if (methodUnderTest.hasThisInParameters ) {
1339
1336
++ expectedParamsSize
1340
1337
}
1341
1338
1342
1339
if (expectedParamsSize == environment.state.parameters.size) {
1343
- statesInitializedFromFuzzing(nextState, hasThis ).firstOrNull()?. let {
1344
- nextState = it
1345
- }
1340
+ statesInitializedFromFuzzing(nextState).firstOrNull()
1341
+ } else {
1342
+ null
1346
1343
}
1344
+ } else {
1345
+ null
1347
1346
}
1348
1347
1349
- pathSelector.offer(nextState)
1348
+ initializedStateByFuzzing?.let {
1349
+ pathSelector.offer(it)
1350
+ } ? : pathSelector.offer(nextState)
1350
1351
}
1351
1352
is JCaughtExceptionRef -> {
1352
1353
val value = localVariableMemory.local(CAUGHT_EXCEPTION )
0 commit comments