mirror of
https://github.com/licsber/micropython.git
synced 2024-09-20 09:00:23 +08:00
tools/mpy-tool.py: Implement freezing of Ellipsis const object.
This commit is contained in:
parent
2cafef857e
commit
9ba3de6ea1
@ -287,7 +287,9 @@ class RawCode:
|
|||||||
# generate constant objects
|
# generate constant objects
|
||||||
for i, obj in enumerate(self.objs):
|
for i, obj in enumerate(self.objs):
|
||||||
obj_name = 'const_obj_%s_%u' % (self.escaped_name, i)
|
obj_name = 'const_obj_%s_%u' % (self.escaped_name, i)
|
||||||
if is_str_type(obj) or is_bytes_type(obj):
|
if obj is Ellipsis:
|
||||||
|
print('#define %s mp_const_ellipsis_obj' % obj_name)
|
||||||
|
elif is_str_type(obj) or is_bytes_type(obj):
|
||||||
if is_str_type(obj):
|
if is_str_type(obj):
|
||||||
obj = bytes_cons(obj, 'utf8')
|
obj = bytes_cons(obj, 'utf8')
|
||||||
obj_type = 'mp_type_str'
|
obj_type = 'mp_type_str'
|
||||||
@ -328,7 +330,6 @@ class RawCode:
|
|||||||
print('STATIC const mp_obj_complex_t %s = {{&mp_type_complex}, %.16g, %.16g};'
|
print('STATIC const mp_obj_complex_t %s = {{&mp_type_complex}, %.16g, %.16g};'
|
||||||
% (obj_name, obj.real, obj.imag))
|
% (obj_name, obj.real, obj.imag))
|
||||||
else:
|
else:
|
||||||
# TODO
|
|
||||||
raise FreezeError(self, 'freezing of object %r is not implemented' % (obj,))
|
raise FreezeError(self, 'freezing of object %r is not implemented' % (obj,))
|
||||||
|
|
||||||
# generate constant table, if it has any entries
|
# generate constant table, if it has any entries
|
||||||
|
Loading…
Reference in New Issue
Block a user