@@ -105,28 +105,29 @@ end
105105
106106function index_constants (tree:: Node , left_index:: Int ):: NodeIndex
107107 index_tree = NodeIndex ()
108- index_constants (tree, index_tree, left_index)
108+ index_constants! (tree, index_tree, left_index)
109109 return index_tree
110110end
111111
112112# 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 )
114114 if tree. degree == 0
115115 if tree. constant
116116 index_tree. constant_index = left_index + 1
117117 end
118118 elseif tree. degree == 1
119119 index_tree. constant_index = count_constants (tree. l)
120120 index_tree. l = NodeIndex ()
121- index_constants (tree. l, index_tree. l, left_index)
121+ index_constants! (tree. l, index_tree. l, left_index)
122122 else
123123 index_tree. l = NodeIndex ()
124124 index_tree. r = NodeIndex ()
125- index_constants (tree. l, index_tree. l, left_index)
125+ index_constants! (tree. l, index_tree. l, left_index)
126126 index_tree. constant_index = count_constants (tree. l)
127127 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)
129129 end
130+ return nothing
130131end
131132
132133end
0 commit comments