Skip to content

Commit f8e5acf

Browse files
committed
style: update name to set_scalar_constants! in benchmarks
1 parent 70c46fc commit f8e5acf

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

benchmark/benchmarks.jl

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ end
1717

1818
if PACKAGE_VERSION < v"0.18.6"
1919
@eval using DynamicExpressions:
20-
index_constants as index_constant_nodes, count_constants as count_constant_nodes
20+
index_constants as index_constant_nodes,
21+
count_constants as count_constant_nodes,
22+
get_constants as get_scalar_constants,
23+
set_constants! as set_scalar_constants!
2124
end
2225

2326
include("../test/tree_gen_utils.jl")
@@ -115,15 +118,16 @@ end
115118
PACKAGE_VERSION < v"0.14.0" && return :(copy_node(t; preserve_sharing=preserve_sharing))
116119
return :(copy_node(t)) # Assume type used to infer sharing
117120
end
118-
@generated function get_set_constants!(tree::N) where {T,N<:AbstractExpressionNode{T}}
119-
if !(@isdefined set_constants!)
120-
return :(set_constants(tree, get_constants(tree)))
121-
elseif hasmethod(set_constants!, Tuple{N, Vector{T}})
122-
return :(set_constants!(tree, get_constants(tree)))
121+
@generated function get_set_constants!(tree::N) where {N}
122+
T = eltype(N)
123+
if !(@isdefined set_scalar_constants!)
124+
return :(set_scalar_constants(tree, get_scalar_constants(tree)))
125+
elseif hasmethod(set_scalar_constants!, Tuple{N, Vector{T}})
126+
return :(set_scalar_constants!(tree, get_scalar_constants(tree)))
123127
else
124128
return quote
125-
let (x, refs) = get_constants(tree)
126-
set_constants!(tree, x, refs)
129+
let (x, refs) = get_scalar_constants(tree)
130+
set_scalar_constants!(tree, x, refs)
127131
end
128132
end
129133
end

0 commit comments

Comments
 (0)