py/emit: Remove need to call set_native_type to set native/viper mode.

The native emitter can easily determine the mode via scope->emit_options.
This commit is contained in:
Damien George 2018-09-15 12:17:14 +10:00
parent 3751512e9d
commit 1d7c221b30
3 changed files with 2 additions and 10 deletions

View File

@ -3456,7 +3456,6 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f
}
comp->emit_method_table = &NATIVE_EMITTER(method_table);
comp->emit = emit_native;
EMIT_ARG(set_native_type, MP_EMIT_NATIVE_TYPE_ENABLE, s->emit_options == MP_EMIT_OPT_VIPER, 0);
break;
#endif // MICROPY_EMIT_NATIVE

View File

@ -51,7 +51,6 @@ typedef enum {
#define MP_EMIT_BREAK_FROM_FOR (0x8000)
#define MP_EMIT_NATIVE_TYPE_ENABLE (0)
#define MP_EMIT_NATIVE_TYPE_RETURN (1)
#define MP_EMIT_NATIVE_TYPE_ARG (2)

View File

@ -224,12 +224,7 @@ void EXPORT_FUN(free)(emit_t *emit) {
}
STATIC void emit_native_set_native_type(emit_t *emit, mp_uint_t op, mp_uint_t arg1, qstr arg2) {
switch (op) {
case MP_EMIT_NATIVE_TYPE_ENABLE:
emit->do_viper_types = arg1;
break;
default: {
{
vtype_kind_t type;
switch (arg2) {
case MP_QSTR_object: type = VTYPE_PYOBJ; break;
@ -248,8 +243,6 @@ STATIC void emit_native_set_native_type(emit_t *emit, mp_uint_t op, mp_uint_t ar
assert(arg1 < emit->local_vtype_alloc);
emit->local_vtype[arg1] = type;
}
break;
}
}
}
@ -262,6 +255,7 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
DEBUG_printf("start_pass(pass=%u, scope=%p)\n", pass, scope);
emit->pass = pass;
emit->do_viper_types = scope->emit_options == MP_EMIT_OPT_VIPER;
emit->stack_start = 0;
emit->stack_size = 0;
emit->last_emit_was_return_value = false;