@@ -181,18 +181,12 @@ preserve_sharing(::Type{<:GraphNode}) = true
181181
182182include (" base.jl" )
183183
184+ # ! format: on
184185@inline function (:: Type{N} )(
185- :: Type{T1} = Undefined;
186- val= nothing ,
187- feature= nothing ,
188- op= nothing ,
189- l= nothing ,
190- r= nothing ,
191- allocator= default_allocator,
186+ :: Type{T1} = Undefined; val= nothing , feature= nothing , op= nothing , l= nothing , r= nothing , allocator= default_allocator,
192187) where {T1,N<: AbstractExpressionNode }
193188 return node_factory (N, T1, val, feature, op, l, r, allocator)
194189end
195-
196190""" Create a constant leaf."""
197191@inline function node_factory (
198192 :: Type{N} , :: Type{T1} , val:: T2 , :: Nothing , :: Nothing , :: Nothing , :: Nothing , allocator
206200end
207201""" Create a variable leaf, to store data."""
208202@inline function node_factory (
209- :: Type{N} ,
210- :: Type{T1} ,
211- :: Nothing ,
212- feature:: Integer ,
213- :: Nothing ,
214- :: Nothing ,
215- :: Nothing ,
216- allocator,
203+ :: Type{N} , :: Type{T1} , :: Nothing , feature:: Integer , :: Nothing , :: Nothing , :: Nothing , allocator,
217204) where {N,T1}
218205 T = node_factory_type (N, T1, DEFAULT_NODE_TYPE)
219206 n = allocator (N, T)
224211end
225212""" Create a unary operator node."""
226213@inline function node_factory (
227- :: Type{N} ,
228- :: Type{T1} ,
229- :: Nothing ,
230- :: Nothing ,
231- op:: Integer ,
232- l:: AbstractExpressionNode{T2} ,
233- :: Nothing ,
234- allocator,
214+ :: Type{N} , :: Type{T1} , :: Nothing , :: Nothing , op:: Integer , l:: AbstractExpressionNode{T2} , :: Nothing , allocator,
235215) where {N,T1,T2}
236216 @assert l isa N
237217 T = T2 # Always prefer existing nodes, so we don't mess up references from conversion
243223end
244224""" Create a binary operator node."""
245225@inline function node_factory (
246- :: Type{N} ,
247- :: Type{T1} ,
248- :: Nothing ,
249- :: Nothing ,
250- op:: Integer ,
251- l:: AbstractExpressionNode{T2} ,
252- r:: AbstractExpressionNode{T3} ,
253- allocator,
226+ :: Type{N} , :: Type{T1} , :: Nothing , :: Nothing , op:: Integer , l:: AbstractExpressionNode{T2} , r:: AbstractExpressionNode{T3} , allocator,
254227) where {N,T1,T2,T3}
255228 T = promote_type (T2, T3)
256229 n = allocator (N, T)
260233 n. r = T3 === T ? r : convert (with_type_parameters (N, T), r)
261234 return n
262235end
236+
263237@inline function node_factory_type (:: Type{N} , :: Type{T1} , :: Type{T2} ) where {N,T1,T2}
264238 if T1 === Undefined && N isa UnionAll
265239 T2
271245 eltype (N)
272246 end
273247end
248+ # ! format: on
274249
275250function (:: Type{N} )(
276251 op:: Integer , l:: AbstractExpressionNode
0 commit comments