Skip to content

Commit

Permalink
py/compile: Don't do unnecessary check if iter parse node is a struct.
Browse files Browse the repository at this point in the history
If we get to this point in the code then pn_iter is guaranteed to be a
struct.
  • Loading branch information
dpgeorge committed Apr 22, 2017
1 parent 03053f8 commit 0dd6a59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2833,14 +2833,14 @@ STATIC void compile_scope_comp_iter(compiler_t *comp, mp_parse_node_struct_t *pn
} else {
EMIT_ARG(store_comp, comp->scope_cur->kind, 4 * for_depth + 5);
}
} else if (MP_PARSE_NODE_IS_STRUCT_KIND(pn_iter, PN_comp_if)) {
} else if (MP_PARSE_NODE_STRUCT_KIND((mp_parse_node_struct_t*)pn_iter) == PN_comp_if) {
// if condition
mp_parse_node_struct_t *pns_comp_if = (mp_parse_node_struct_t*)pn_iter;
c_if_cond(comp, pns_comp_if->nodes[0], false, l_top);
pn_iter = pns_comp_if->nodes[1];
goto tail_recursion;
} else {
assert(MP_PARSE_NODE_IS_STRUCT_KIND(pn_iter, PN_comp_for)); // should be
assert(MP_PARSE_NODE_STRUCT_KIND((mp_parse_node_struct_t*)pn_iter) == PN_comp_for); // should be
// for loop
mp_parse_node_struct_t *pns_comp_for2 = (mp_parse_node_struct_t*)pn_iter;
compile_node(comp, pns_comp_for2->nodes[1]);
Expand Down

0 comments on commit 0dd6a59

Please sign in to comment.