mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 04:00:28 +01:00
py/emit: Combine import from/name/star into one emit function.
Change in code size is:
bare-arm: +4
minimal x86: -88
unix x64: -456
unix nanbox: -88
stm32: -44
cc3200: +0
esp8266: -104
esp32: +8
This commit is contained in:
@@ -837,6 +837,16 @@ STATIC void emit_native_import_star(emit_t *emit) {
|
||||
emit_post(emit);
|
||||
}
|
||||
|
||||
STATIC void emit_native_import(emit_t *emit, qstr qst, int kind) {
|
||||
if (kind == MP_EMIT_IMPORT_NAME) {
|
||||
emit_native_import_name(emit, qst);
|
||||
} else if (kind == MP_EMIT_IMPORT_FROM) {
|
||||
emit_native_import_from(emit, qst);
|
||||
} else {
|
||||
emit_native_import_star(emit);
|
||||
}
|
||||
}
|
||||
|
||||
STATIC void emit_native_load_const_tok(emit_t *emit, mp_token_kind_t tok) {
|
||||
DEBUG_printf("load_const_tok(tok=%u)\n", tok);
|
||||
emit_native_pre(emit);
|
||||
@@ -2223,9 +2233,7 @@ const emit_method_table_t EXPORT_FUN(method_table) = {
|
||||
},
|
||||
|
||||
emit_native_label_assign,
|
||||
emit_native_import_name,
|
||||
emit_native_import_from,
|
||||
emit_native_import_star,
|
||||
emit_native_import,
|
||||
emit_native_load_const_tok,
|
||||
emit_native_load_const_small_int,
|
||||
emit_native_load_const_str,
|
||||
|
||||
Reference in New Issue
Block a user