@@ -17,7 +17,7 @@ mutable struct InferenceState
17
17
valid_worlds:: WorldRange
18
18
nargs:: Int
19
19
stmt_types:: Vector{Any}
20
- stmt_edges:: Vector{Any}
20
+ stmt_edges:: Vector{Union{Nothing, Vector{ Any}} }
21
21
stmt_info:: Vector{Any}
22
22
# return type
23
23
bestguess # ::Type
@@ -66,7 +66,7 @@ mutable struct InferenceState
66
66
stmt_info = Any[ nothing for i = 1 : length (code) ]
67
67
68
68
n = length (code)
69
- s_edges = Any[ nothing for i = 1 : n ]
69
+ s_edges = Union{Nothing, Vector{ Any}} [ nothing for i = 1 : n ]
70
70
s_types = Any[ nothing for i = 1 : n ]
71
71
72
72
# initial types
@@ -245,21 +245,23 @@ end
245
245
# temporarily accumulate our edges to later add as backedges in the callee
246
246
function add_backedge! (li:: MethodInstance , caller:: InferenceState )
247
247
isa (caller. linfo. def, Method) || return # don't add backedges to toplevel exprs
248
- if caller. stmt_edges[caller. currpc] === nothing
249
- caller. stmt_edges[caller. currpc] = []
248
+ edges = caller. stmt_edges[caller. currpc]
249
+ if edges === nothing
250
+ edges = caller. stmt_edges[caller. currpc] = []
250
251
end
251
- push! (caller . stmt_edges[caller . currpc] , li)
252
+ push! (edges , li)
252
253
nothing
253
254
end
254
255
255
256
# used to temporarily accumulate our no method errors to later add as backedges in the callee method table
256
257
function add_mt_backedge! (mt:: Core.MethodTable , @nospecialize (typ), caller:: InferenceState )
257
258
isa (caller. linfo. def, Method) || return # don't add backedges to toplevel exprs
258
- if caller. stmt_edges[caller. currpc] === nothing
259
- caller. stmt_edges[caller. currpc] = []
259
+ edges = caller. stmt_edges[caller. currpc]
260
+ if edges === nothing
261
+ edges = caller. stmt_edges[caller. currpc] = []
260
262
end
261
- push! (caller . stmt_edges[caller . currpc] , mt)
262
- push! (caller . stmt_edges[caller . currpc] , typ)
263
+ push! (edges , mt)
264
+ push! (edges , typ)
263
265
nothing
264
266
end
265
267
0 commit comments