We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 68cebed commit 4374a26Copy full SHA for 4374a26
1 file changed
utbot-python/src/main/kotlin/org/utbot/python/framework/api/python/PythonTree.kt
@@ -28,14 +28,13 @@ object PythonTree {
28
return isRecursiveObjectDFS(tree, mutableSetOf())
29
}
30
31
- private fun isRecursiveObjectDFS(tree: PythonTreeNode, visited: MutableSet<PythonTreeNode>): Boolean {
+ private fun isRecursiveObjectDFS(tree: PythonTreeNode, visited: Set<PythonTreeNode>): Boolean {
32
if (tree is PrimitiveNode) {
33
return false
34
35
if (visited.contains(tree))
36
return true
37
- visited.add(tree)
38
- return tree.children.any { isRecursiveObjectDFS(it, visited) }
+ return tree.children.any { isRecursiveObjectDFS(it, visited + tree) }
39
40
41
fun containsFakeNode(tree: PythonTreeNode): Boolean {
0 commit comments