Skip to content

Commit 38224ee

Browse files
Remove isInNestedMethod function from engine
1 parent 84d59d2 commit 38224ee

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

utbot-framework/src/main/kotlin/org/utbot/engine/Strings.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class StringWrapper : BaseOverriddenWrapper(utStringClass.name) {
128128
explicitThrown(
129129
StringIndexOutOfBoundsException(),
130130
findNewAddr(),
131-
isInNestedMethod()
131+
environment.state.isInNestedMethod()
132132
),
133133
hardConstraints = mkNot(inBoundsCondition).asHardConstraint()
134134
)

utbot-framework/src/main/kotlin/org/utbot/engine/Traverser.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ class Traverser(
13061306
* Returns null if mock is not allowed - Engine traverses nested method call or parameter type is not RefType.
13071307
*/
13081308
private fun parameterMockInfoGenerator(parameterRef: IdentityRef): UtMockInfoGenerator? {
1309-
if (isInNestedMethod()) return null
1309+
if (environment.state.isInNestedMethod()) return null
13101310
if (parameterRef !is ParameterRef) return null
13111311
val type = parameterRef.type
13121312
if (type !is RefType) return null
@@ -1518,7 +1518,7 @@ class Traverser(
15181518
}
15191519

15201520
private suspend fun FlowCollector<UtResult>.traverseThrowStmt(current: JThrowStmt) {
1521-
val symException = explicitThrown(resolve(current.op), isInNestedMethod())
1521+
val symException = explicitThrown(resolve(current.op), environment.state.isInNestedMethod())
15221522
traverseException(current, symException)
15231523
}
15241524

@@ -3540,7 +3540,7 @@ class Traverser(
35403540
) {
35413541
if (environment.state.executionStack.last().doesntThrow) return
35423542

3543-
val symException = implicitThrown(exception, findNewAddr(), isInNestedMethod())
3543+
val symException = implicitThrown(exception, findNewAddr(), environment.state.isInNestedMethod())
35443544
if (!traverseCatchBlock(environment.state.stmt, symException, conditions)) {
35453545
environment.state.expectUndefined()
35463546
val nextState = environment.state.createExceptionState(
@@ -3667,7 +3667,9 @@ class Traverser(
36673667

36683668
workaround(REMOVE_ANONYMOUS_CLASSES) {
36693669
val sootClass = returnValue.type.sootClass
3670-
if (!isInNestedMethod() && (sootClass.isAnonymous || sootClass.isArtificialEntity)) return
3670+
if (!environment.state.isInNestedMethod() && (sootClass.isAnonymous || sootClass.isArtificialEntity)) {
3671+
return
3672+
}
36713673
}
36723674
}
36733675

@@ -3688,15 +3690,15 @@ class Traverser(
36883690
val updatedMemory = memory.update(queuedSymbolicStateUpdates.memoryUpdates)
36893691

36903692
//no need to respect soft constraints in NestedMethod
3691-
val holder = newSolver.check(respectSoft = !isInNestedMethod())
3693+
val holder = newSolver.check(respectSoft = !environment.state.isInNestedMethod())
36923694

36933695
if (holder !is UtSolverStatusSAT) {
36943696
logger.trace { "processResult<${environment.method.signature}> UNSAT" }
36953697
return
36963698
}
36973699

36983700
//execution frame from level 2 or above
3699-
if (isInNestedMethod()) {
3701+
if (environment.state.isInNestedMethod()) {
37003702
// static fields substitution
37013703
// TODO: JIRA:1610 -- better way of working with statics
37023704
val updates = if (environment.method.name == STATIC_INITIALIZER && substituteStaticsWithSymbolicVariable) {
@@ -3793,8 +3795,6 @@ class Traverser(
37933795
}
37943796
}
37953797

3796-
internal fun isInNestedMethod() = environment.state.isInNestedMethod()
3797-
37983798
private fun ReturnStmt.symbolicSuccess(): SymbolicSuccess {
37993799
val type = environment.method.returnType
38003800
val value = when (val instance = resolve(op, type)) {

0 commit comments

Comments
 (0)