Skip to content

Commit b4d71b0

Browse files
committed
style: consistent usage of max_degree
1 parent eeafb34 commit b4d71b0

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/Evaluate.jl

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ module EvaluateModule
33
using DispatchDoctor: @stable, @unstable
44

55
import ..NodeModule:
6-
AbstractExpressionNode,
7-
constructorof,
8-
max_degree,
9-
get_children,
10-
get_child,
11-
with_type_parameters
6+
AbstractExpressionNode, constructorof, get_children, get_child, with_type_parameters
127
import ..StringsModule: string_tree
138
import ..OperatorEnumModule: AbstractOperatorEnum, OperatorEnum, GenericOperatorEnum
149
import ..UtilsModule: fill_similar, counttuple, ResultOk
@@ -264,11 +259,11 @@ end
264259
end
265260

266261
function _eval_tree_array(
267-
tree::AbstractExpressionNode{T},
262+
tree::AbstractExpressionNode{T,D},
268263
cX::AbstractMatrix{T},
269264
operators::OperatorEnum,
270265
eval_options::EvalOptions,
271-
)::ResultOk where {T}
266+
)::ResultOk where {T,D}
272267
# First, we see if there are only constants in the tree - meaning
273268
# we can just return the constant result.
274269
if tree.degree == 0
@@ -284,7 +279,7 @@ function _eval_tree_array(
284279
elseif tree.degree == 1
285280
op_idx = tree.op
286281
return dispatch_deg1_eval(tree, cX, op_idx, operators, eval_options)
287-
elseif max_degree(tree) == 2 || tree.degree == 2
282+
elseif D == 2 || tree.degree == 2
288283
# TODO - add op(op2(x, y), z) and op(x, op2(y, z))
289284
# op(x, y), where x, y are constants or variables.
290285
op_idx = tree.op
@@ -400,12 +395,11 @@ end
400395

401396
# This forms an if statement over the degree of a given node.
402397
@generated function dispatch_degn_eval(
403-
tree::AbstractExpressionNode{T},
398+
tree::AbstractExpressionNode{T,D},
404399
cX::AbstractMatrix{T},
405400
operators::OperatorEnum,
406401
eval_options::EvalOptions,
407-
) where {T}
408-
D = max_degree(tree)
402+
) where {T,D}
409403
return quote
410404
# If statement over degrees
411405
degree = tree.degree

0 commit comments

Comments
 (0)