Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
7385b018
Commit
7385b018
authored
Sep 27, 2016
by
Damien George
Browse files
py/emitbc: Remove/refactor unreachable code, to improve coverage.
parent
897129a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/emitbc.c
View file @
7385b018
...
...
@@ -302,15 +302,6 @@ STATIC void emit_write_bytecode_byte_signed_label(emit_t *emit, byte b1, mp_uint
c
[
2
]
=
bytecode_offset
>>
8
;
}
#if MICROPY_EMIT_NATIVE
STATIC
void
mp_emit_bc_set_native_type
(
emit_t
*
emit
,
mp_uint_t
op
,
mp_uint_t
arg1
,
qstr
arg2
)
{
(
void
)
emit
;
(
void
)
op
;
(
void
)
arg1
;
(
void
)
arg2
;
}
#endif
void
mp_emit_bc_start_pass
(
emit_t
*
emit
,
pass_kind_t
pass
,
scope_t
*
scope
)
{
emit
->
pass
=
pass
;
emit
->
stack_size
=
0
;
...
...
@@ -408,9 +399,7 @@ void mp_emit_bc_end_pass(emit_t *emit) {
}
// check stack is back to zero size
if
(
emit
->
stack_size
!=
0
)
{
mp_printf
(
&
mp_plat_print
,
"ERROR: stack size not back to zero; got %d
\n
"
,
emit
->
stack_size
);
}
assert
(
emit
->
stack_size
==
0
);
emit_write_code_info_byte
(
emit
,
0
);
// end of line number info
...
...
@@ -528,9 +517,10 @@ void mp_emit_bc_load_const_tok(emit_t *emit, mp_token_kind_t tok) {
case
MP_TOKEN_KW_FALSE
:
emit_write_bytecode_byte
(
emit
,
MP_BC_LOAD_CONST_FALSE
);
break
;
case
MP_TOKEN_KW_NONE
:
emit_write_bytecode_byte
(
emit
,
MP_BC_LOAD_CONST_NONE
);
break
;
case
MP_TOKEN_KW_TRUE
:
emit_write_bytecode_byte
(
emit
,
MP_BC_LOAD_CONST_TRUE
);
break
;
no_other_choice:
case
MP_TOKEN_ELLIPSIS
:
emit_write_bytecode_byte_obj
(
emit
,
MP_BC_LOAD_CONST_OBJ
,
MP_OBJ_FROM_PTR
(
&
mp_const_ellipsis_obj
));
break
;
default:
assert
(
0
);
goto
no_other_choice
;
// to help flow control analysis
default:
assert
(
tok
==
MP_TOKEN_ELLIPSIS
);
emit_write_bytecode_byte_obj
(
emit
,
MP_BC_LOAD_CONST_OBJ
,
MP_OBJ_FROM_PTR
(
&
mp_const_ellipsis_obj
));
break
;
}
}
...
...
@@ -964,7 +954,7 @@ void mp_emit_bc_end_except_handler(emit_t *emit) {
#if MICROPY_EMIT_NATIVE
const
emit_method_table_t
emit_bc_method_table
=
{
mp_emit_bc_
set_native_type
,
NULL
,
//
set_native_type
is never called when emitting bytecode
mp_emit_bc_start_pass
,
mp_emit_bc_end_pass
,
mp_emit_bc_last_emit_was_return_value
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment