File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -320,6 +320,9 @@ def freeze(self, parent_name):
320320 print ('STATIC const mp_obj_float_t %s = {{&mp_type_float}, %.16g};'
321321 % (obj_name , obj ))
322322 print ('#endif' )
323+ elif type (obj ) is complex :
324+ print ('STATIC const mp_obj_complex_t %s = {{&mp_type_complex}, %.16g, %.16g};'
325+ % (obj_name , obj .real , obj .imag ))
323326 else :
324327 # TODO
325328 raise FreezeError (self , 'freezing of object %r is not implemented' % (obj ,))
@@ -485,6 +488,15 @@ def freeze_mpy(base_qstrs, raw_codes):
485488 print ('#endif' )
486489 print ()
487490
491+ print ('#if MICROPY_PY_BUILTINS_COMPLEX' )
492+ print ('typedef struct _mp_obj_complex_t {' )
493+ print (' mp_obj_base_t base;' )
494+ print (' mp_float_t real;' )
495+ print (' mp_float_t imag;' )
496+ print ('} mp_obj_complex_t;' )
497+ print ('#endif' )
498+ print ()
499+
488500 print ('enum {' )
489501 for i in range (len (new )):
490502 if i == 0 :
You can’t perform that action at this time.
0 commit comments