Skip to content

Commit 7dfa56e

Browse files
committed
py/compile: Adjust c_assign_atom_expr() to use return instead of goto.
Makes the flow of the function a little more obvious, and allows to reach 100% coverage of compile.c when using gcov.
1 parent 2ad555b commit 7dfa56e

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

py/compile.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ STATIC void c_assign_atom_expr(compiler_t *comp, mp_parse_node_struct_t *pns, as
376376
EMIT(store_subscr);
377377
}
378378
}
379+
return;
379380
} else if (MP_PARSE_NODE_STRUCT_KIND(pns1) == PN_trailer_period) {
380381
assert(MP_PARSE_NODE_IS_ID(pns1->nodes[0]));
381382
if (assign_kind == ASSIGN_AUG_LOAD) {
@@ -387,16 +388,10 @@ STATIC void c_assign_atom_expr(compiler_t *comp, mp_parse_node_struct_t *pns, as
387388
}
388389
EMIT_ARG(store_attr, MP_PARSE_NODE_LEAF_ARG(pns1->nodes[0]));
389390
}
390-
} else {
391-
goto cannot_assign;
391+
return;
392392
}
393-
} else {
394-
goto cannot_assign;
395393
}
396394

397-
return;
398-
399-
cannot_assign:
400395
compile_syntax_error(comp, (mp_parse_node_t)pns, "can't assign to expression");
401396
}
402397

0 commit comments

Comments
 (0)