Skip to content

Commit 1611f35

Browse files
committed
Update PythonTree model
1 parent 6321806 commit 1611f35

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/PythonTree.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ object PythonTree {
88
var comparable: Boolean = true
99
) {
1010
open val children: List<PythonTreeNode> = emptyList()
11-
fun maxDepth(): Int = 1 + children.map { it.maxDepth() }.max()
1211

1312
open fun typeEquals(other: Any?): Boolean {
1413
return if (other is PythonTreeNode)
@@ -94,7 +93,7 @@ object PythonTree {
9493
class ReduceNode(
9594
val id: PythonId,
9695
type: PythonClassId,
97-
val constructor: String,
96+
val constructor: PythonClassId,
9897
val args: List<PythonTreeNode>,
9998
var state: Map<String, PythonTreeNode>,
10099
var listitems: List<PythonTreeNode>,
@@ -103,12 +102,12 @@ object PythonTree {
103102
constructor(
104103
id: PythonId,
105104
type: PythonClassId,
106-
constructor: String,
105+
constructor: PythonClassId,
107106
args: List<PythonTreeNode>,
108107
): this(id, type, constructor, args, emptyMap(), emptyList(), emptyMap())
109108

110109
override val children: List<PythonTreeNode>
111-
get() = args + state.values + listitems + dictitems.values + dictitems.keys
110+
get() = args + state.values + listitems + dictitems.values + dictitems.keys + PythonTreeNode(constructor)
112111

113112
override fun typeEquals(other: Any?): Boolean {
114113
return if (other is ReduceNode) {

utbot-python/src/main/kotlin/org/utbot/python/code/KlaxonPythonTreeParser.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class KlaxonPythonTreeParser(
6969
val initObject = PythonTree.ReduceNode(
7070
id,
7171
PythonClassId(value.string("type")!!),
72-
value.string("constructor")!!,
72+
PythonClassId(value.string("constructor")!!),
7373
parsePythonList(value.array("args")!!).items,
7474
)
7575
memory[id] = initObject

0 commit comments

Comments
 (0)