Skip to content

Commit 0f7ac3d

Browse files
Introduce TraversingContext
1 parent 62eb151 commit 0f7ac3d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.utbot.engine
2+
3+
/**
4+
* Represents a mutable _Context_ during the [ExecutionState] traversing. This _Context_ consists of all mutable and
5+
* immutable properties and fields which are created and updated during analysis of **one** Jimple instruction.
6+
*
7+
* Traverser functions should be implemented as an extension functions with [TraversalContext] as a receiver.
8+
*
9+
* TODO: extend this class with other properties, such as [Environment], which is [Traverser] mutable property now.
10+
*/
11+
class TraversalContext {
12+
// TODO: move properties from [UtBotSymbolicEngine] here
13+
14+
15+
// TODO: Q: maybe it's better to pass stateConsumer as an argument to constructor?
16+
private val states = mutableListOf<ExecutionState>()
17+
18+
/**
19+
* Offers new [ExecutionState] which can be obtained later with [nextStates].
20+
*/
21+
fun offerState(state: ExecutionState) {
22+
states.add(state)
23+
}
24+
25+
/**
26+
* New states from traversal.
27+
*/
28+
val nextStates: Collection<ExecutionState>
29+
get() = states
30+
}

0 commit comments

Comments
 (0)