py/persistentcode: Define enum values for obj types instead of letters.

To keep the separate parts of the code that use these values in sync.  And
make it easier to add new object types.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2022-04-07 22:18:37 +10:00
parent 988827b85a
commit 42d0bd2c17
3 changed files with 42 additions and 24 deletions

View File

@@ -102,6 +102,16 @@ enum {
MP_NATIVE_ARCH_XTENSAWIN,
};
enum {
MP_PERSISTENT_OBJ_FUN_TABLE = 0,
MP_PERSISTENT_OBJ_ELLIPSIS,
MP_PERSISTENT_OBJ_STR,
MP_PERSISTENT_OBJ_BYTES,
MP_PERSISTENT_OBJ_INT,
MP_PERSISTENT_OBJ_FLOAT,
MP_PERSISTENT_OBJ_COMPLEX,
};
mp_compiled_module_t mp_raw_code_load(mp_reader_t *reader, mp_module_context_t *ctx);
mp_compiled_module_t mp_raw_code_load_mem(const byte *buf, size_t len, mp_module_context_t *ctx);
mp_compiled_module_t mp_raw_code_load_file(const char *filename, mp_module_context_t *ctx);