@@ -2253,28 +2253,24 @@ STATIC void compile_lambdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
22532253 close_over_variables_etc (comp , this_scope , 0 , 0 );
22542254}
22552255
2256- STATIC void compile_or_test (compiler_t * comp , mp_parse_node_struct_t * pns ) {
2256+ STATIC void compile_or_and_test (compiler_t * comp , mp_parse_node_struct_t * pns , bool cond ) {
22572257 uint l_end = comp_next_label (comp );
22582258 int n = MP_PARSE_NODE_STRUCT_NUM_NODES (pns );
22592259 for (int i = 0 ; i < n ; i += 1 ) {
22602260 compile_node (comp , pns -> nodes [i ]);
22612261 if (i + 1 < n ) {
2262- EMIT_ARG (jump_if_or_pop , true , l_end );
2262+ EMIT_ARG (jump_if_or_pop , cond , l_end );
22632263 }
22642264 }
22652265 EMIT_ARG (label_assign , l_end );
22662266}
22672267
2268+ STATIC void compile_or_test (compiler_t * comp , mp_parse_node_struct_t * pns ) {
2269+ compile_or_and_test (comp , pns , true);
2270+ }
2271+
22682272STATIC void compile_and_test (compiler_t * comp , mp_parse_node_struct_t * pns ) {
2269- uint l_end = comp_next_label (comp );
2270- int n = MP_PARSE_NODE_STRUCT_NUM_NODES (pns );
2271- for (int i = 0 ; i < n ; i += 1 ) {
2272- compile_node (comp , pns -> nodes [i ]);
2273- if (i + 1 < n ) {
2274- EMIT_ARG (jump_if_or_pop , false, l_end );
2275- }
2276- }
2277- EMIT_ARG (label_assign , l_end );
2273+ compile_or_and_test (comp , pns , false);
22782274}
22792275
22802276STATIC void compile_not_test_2 (compiler_t * comp , mp_parse_node_struct_t * pns ) {
0 commit comments