Skip to content

Commit dd81086

Browse files
committed
Fix weird return value from recursive
1 parent 946dee5 commit dd81086

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/EquationUtils.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,28 +105,29 @@ end
105105

106106
function 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
110110
end
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
130131
end
131132

132133
end

0 commit comments

Comments
 (0)