@@ -140,6 +140,39 @@ baremodule __deserialized_types__ end
140
140
end
141
141
return tn
142
142
end
143
+ else @static if VERSION < v " 1.10-"
144
+ function newstruct_raw (cache, :: Type{TypeName} , d, init)
145
+ name = raise_recursive (d[:data ][2 ], cache, init)
146
+ name = isdefined (__deserialized_types__, name) ? gensym () : name
147
+ tn = ccall (:jl_new_typename_in , Ref{Core. TypeName}, (Any, Any),
148
+ name, __deserialized_types__)
149
+ cache[d] = tn
150
+ names, super, parameters, types, has_instance, atomicfields,
151
+ abstr, mutabl, ninitialized = map (x -> raise_recursive (x, cache, init), d[:data ][3 : end - 1 ])
152
+ ndt = ccall (:jl_new_datatype , Any, (Any, Any, Any, Any, Any, Any, Any, Cint, Cint, Cint),
153
+ tn, tn. module, super, parameters, names, types, atomicfields,
154
+ abstr, mutabl, ninitialized)
155
+ # ty = tn.wrapper = ndt.name.wrapper
156
+ ty = ndt. name. wrapper
157
+ ccall (:jl_set_const , Cvoid, (Any, Any, Any), tn. module, tn. name, ty)
158
+ if has_instance && ! isdefined (ty, :instance )
159
+ # use setfield! directly to avoid `fieldtype` lowering expecting to see a Singleton object already on ty
160
+ Core. setfield! (ty, :instance , ccall (:jl_new_struct , Any, (Any, Any... ), ty))
161
+ end
162
+ mt = raise_recursive (d[:data ][end ], cache, init)
163
+ if mt != nothing
164
+ mtname, defs, maxa, kwsorter = mt
165
+ mt = ccall (:jl_new_method_table , Any, (Any, Any), name, tn. module)
166
+ mt. name = mtname
167
+ mt. max_args = maxa
168
+ ccall (:jl_set_nth_field , Cvoid, (Any, Csize_t, Any), tn, Base. fieldindex (Core. TypeName, :mt )- 1 , mt)
169
+ for def in defs
170
+ isdefined (def, :sig ) || continue
171
+ ccall (:jl_method_table_insert , Cvoid, (Any, Any, Ptr{Cvoid}), mt, def, C_NULL )
172
+ end
173
+ end
174
+ return tn
175
+ end
143
176
else
144
177
function newstruct_raw (cache, :: Type{TypeName} , d, init)
145
178
name = raise_recursive (d[:data ][2 ], cache, init)
174
207
return tn
175
208
end
176
209
end
210
+ end
177
211
178
212
# Function Types
179
213
0 commit comments