py/lexer: Remove unnecessary code, and unreachable code.
Setting emit_dent=0 is unnecessary because arriving in that part of the
if-logic will guarantee that emit_dent is already zero.
The block to check indent_top(lex)>0 is unreachable because a newline is
always inserted an the end of the input stream, and hence dedents are
always processed before EOF.
diff --git a/py/lexer.c b/py/lexer.c
index b2c9c5f..4a7c8f5 100644
--- a/py/lexer.c
+++ b/py/lexer.c
@@ -343,7 +343,6 @@
lex->tok_kind = MP_TOKEN_NEWLINE;
mp_uint_t num_spaces = lex->column - 1;
- lex->emit_dent = 0;
if (num_spaces == indent_top(lex)) {
} else if (num_spaces > indent_top(lex)) {
indent_push(lex, num_spaces);
@@ -359,16 +358,7 @@
}
} else if (is_end(lex)) {
- if (indent_top(lex) > 0) {
- lex->tok_kind = MP_TOKEN_NEWLINE;
- lex->emit_dent = 0;
- while (indent_top(lex) > 0) {
- indent_pop(lex);
- lex->emit_dent -= 1;
- }
- } else {
- lex->tok_kind = MP_TOKEN_END;
- }
+ lex->tok_kind = MP_TOKEN_END;
} else if (is_char_or(lex, '\'', '\"')
|| (is_char_or3(lex, 'r', 'u', 'b') && is_char_following_or(lex, '\'', '\"'))