@@ -217,10 +217,18 @@ pub struct PrimitiveObjects {
217217 pub function_type : ObjectRef ,
218218 pub code_type : ObjectRef ,
219219
220+ pub module : ObjectRef ,
221+
220222 pub baseexception : ObjectRef ,
221- pub runtimeerror : ObjectRef ,
223+ pub processorerror : ObjectRef ,
224+ pub exception : ObjectRef ,
222225
223- pub module : ObjectRef ,
226+ pub nameerror : ObjectRef ,
227+ pub attributeerror : ObjectRef ,
228+ pub typeerror : ObjectRef ,
229+
230+ pub lookuperror : ObjectRef ,
231+ pub keyerror : ObjectRef ,
224232
225233 pub names_map : HashMap < String , ObjectRef > ,
226234}
@@ -252,10 +260,19 @@ impl PrimitiveObjects {
252260 let function_type = store. allocate ( Object :: new_class ( "function" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ obj_ref. clone( ) ] ) ) ;
253261 let code_type = store. allocate ( Object :: new_class ( "code" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ obj_ref. clone( ) ] ) ) ;
254262
263+ let module = store. allocate ( Object :: new_class ( "module" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ obj_ref. clone( ) ] ) ) ;
264+
255265 let baseexception = store. allocate ( Object :: new_class ( "BaseException" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ obj_ref. clone( ) ] ) ) ;
256- let runtimeerror = store. allocate ( Object :: new_class ( "RuntimeError" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ baseexception. clone( ) ] ) ) ;
266+ let processorerror = store. allocate ( Object :: new_class ( "ProcessorError" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ baseexception. clone( ) ] ) ) ;
267+ let exception = store. allocate ( Object :: new_class ( "Exception" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ baseexception. clone( ) ] ) ) ;
268+
269+ let nameerror = store. allocate ( Object :: new_class ( "NameError" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ exception. clone( ) ] ) ) ;
270+ let attributeerror = store. allocate ( Object :: new_class ( "AttributeError" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ exception. clone( ) ] ) ) ;
271+ let typeerror = store. allocate ( Object :: new_class ( "TypeError" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ exception. clone( ) ] ) ) ;
272+
273+ let lookuperror = store. allocate ( Object :: new_class ( "LookupError" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ exception. clone( ) ] ) ) ;
274+ let keyerror = store. allocate ( Object :: new_class ( "KeyError" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ lookuperror. clone( ) ] ) ) ;
257275
258- let module = store. allocate ( Object :: new_class ( "module" . to_string ( ) , None , type_ref. clone ( ) , vec ! [ obj_ref. clone( ) ] ) ) ;
259276
260277 let mut map = HashMap :: new ( ) ;
261278 map. insert ( "object" . to_string ( ) , obj_ref. clone ( ) ) ;
@@ -274,10 +291,20 @@ impl PrimitiveObjects {
274291 map. insert ( "str" . to_string ( ) , str_type. clone ( ) ) ;
275292 map. insert ( "function" . to_string ( ) , function_type. clone ( ) ) ;
276293 map. insert ( "code" . to_string ( ) , code_type. clone ( ) ) ;
277- map. insert ( "BaseException" . to_string ( ) , baseexception. clone ( ) ) ;
278- map. insert ( "RuntimeError" . to_string ( ) , runtimeerror. clone ( ) ) ;
279294 map. insert ( "module" . to_string ( ) , module. clone ( ) ) ;
280295
296+ // Base classes
297+ map. insert ( "BaseException" . to_string ( ) , baseexception. clone ( ) ) ;
298+ map. insert ( "ProcessorError" . to_string ( ) , processorerror. clone ( ) ) ;
299+ map. insert ( "Exception" . to_string ( ) , exception. clone ( ) ) ;
300+
301+ map. insert ( "NameError" . to_string ( ) , nameerror. clone ( ) ) ;
302+ map. insert ( "AttributeError" . to_string ( ) , attributeerror. clone ( ) ) ;
303+ map. insert ( "TypeError" . to_string ( ) , typeerror. clone ( ) ) ;
304+
305+ map. insert ( "LookupError" . to_string ( ) , lookuperror. clone ( ) ) ;
306+ map. insert ( "KeyError" . to_string ( ) , keyerror. clone ( ) ) ;
307+
281308 PrimitiveObjects {
282309 object : obj_ref, type_ : type_ref,
283310 none_type : none_type, none : none,
@@ -286,7 +313,9 @@ impl PrimitiveObjects {
286313 set_type : set_type, frozenset_type : frozenset_type,
287314 bytes_type : bytes_type, str_type : str_type,
288315 function_type : function_type, code_type : code_type,
289- baseexception : baseexception, runtimeerror : runtimeerror,
316+ baseexception : baseexception, processorerror : processorerror, exception : exception,
317+ nameerror : nameerror, attributeerror : attributeerror, typeerror : typeerror,
318+ lookuperror : lookuperror, keyerror : keyerror,
290319 module : module,
291320 names_map : map,
292321 }
0 commit comments