1
1
module PatchMethodsModule
2
2
3
+ using DynamicExpressions: get_contents, with_contents
3
4
using .. OperatorEnumModule: AbstractOperatorEnum
4
5
using .. NodeModule: constructorof
5
6
using .. ExpressionModule: Expression, get_tree, get_operators
@@ -11,17 +12,15 @@ function combine_operators(
11
12
ex:: Union{Expression{T,N},ParametricExpression{T,N}} ,
12
13
operators:: Union{AbstractOperatorEnum,Nothing} = nothing ,
13
14
) where {T,N}
14
- return constructorof ( typeof (ex)) (
15
- combine_operators (get_tree (ex):: N , get_operators (ex, operators)), ex . metadata
15
+ return with_contents (
16
+ ex, combine_operators (get_contents (ex), get_operators (ex, operators))
16
17
)
17
18
end
18
19
function simplify_tree! (
19
20
ex:: Union{Expression{T,N},ParametricExpression{T,N}} ,
20
21
operators:: Union{AbstractOperatorEnum,Nothing} = nothing ,
21
22
) where {T,N}
22
- return constructorof (typeof (ex))(
23
- simplify_tree! (get_tree (ex):: N , get_operators (ex, operators)), ex. metadata
24
- )
23
+ return with_contents (ex, simplify_tree! (get_contents (ex), get_operators (ex, operators)))
25
24
end
26
25
27
26
end
0 commit comments