@@ -105,28 +105,29 @@ end
105
105
106
106
function index_constants (tree:: Node , left_index:: Int ):: NodeIndex
107
107
index_tree = NodeIndex ()
108
- index_constants (tree, index_tree, left_index)
108
+ index_constants! (tree, index_tree, left_index)
109
109
return index_tree
110
110
end
111
111
112
112
# Count how many constants to the left of this node, and put them in a tree
113
- function index_constants (tree:: Node , index_tree:: NodeIndex , left_index:: Int )
113
+ function index_constants! (tree:: Node , index_tree:: NodeIndex , left_index:: Int )
114
114
if tree. degree == 0
115
115
if tree. constant
116
116
index_tree. constant_index = left_index + 1
117
117
end
118
118
elseif tree. degree == 1
119
119
index_tree. constant_index = count_constants (tree. l)
120
120
index_tree. l = NodeIndex ()
121
- index_constants (tree. l, index_tree. l, left_index)
121
+ index_constants! (tree. l, index_tree. l, left_index)
122
122
else
123
123
index_tree. l = NodeIndex ()
124
124
index_tree. r = NodeIndex ()
125
- index_constants (tree. l, index_tree. l, left_index)
125
+ index_constants! (tree. l, index_tree. l, left_index)
126
126
index_tree. constant_index = count_constants (tree. l)
127
127
left_index_here = left_index + index_tree. constant_index
128
- index_constants (tree. r, index_tree. r, left_index_here)
128
+ index_constants! (tree. r, index_tree. r, left_index_here)
129
129
end
130
+ return nothing
130
131
end
131
132
132
133
end
0 commit comments