@@ -273,7 +273,7 @@ STATIC void c_tuple(compiler_t *comp, mp_parse_node_t pn, mp_parse_node_struct_t
273273 }
274274 total += n ;
275275 }
276- EMIT_ARG (build_tuple , total );
276+ EMIT_ARG (build , total , MP_EMIT_BUILD_TUPLE );
277277}
278278
279279STATIC void compile_generic_tuple (compiler_t * comp , mp_parse_node_struct_t * pns ) {
@@ -652,12 +652,12 @@ STATIC void compile_funcdef_lambdef_param(compiler_t *comp, mp_parse_node_t pn)
652652 // in MicroPython we put the default positional parameters into a tuple using the bytecode
653653 // we need to do this here before we start building the map for the default keywords
654654 if (comp -> num_default_params > 0 ) {
655- EMIT_ARG (build_tuple , comp -> num_default_params );
655+ EMIT_ARG (build , comp -> num_default_params , MP_EMIT_BUILD_TUPLE );
656656 } else {
657657 EMIT (load_null ); // sentinel indicating empty default positional args
658658 }
659659 // first default dict param, so make the map
660- EMIT_ARG (build_map , 0 );
660+ EMIT_ARG (build , 0 , MP_EMIT_BUILD_MAP );
661661 }
662662
663663 // compile value then key, then store it to the dict
@@ -693,7 +693,7 @@ STATIC void compile_funcdef_lambdef(compiler_t *comp, scope_t *scope, mp_parse_n
693693 // in MicroPython we put the default positional parameters into a tuple using the bytecode
694694 // the default keywords args may have already made the tuple; if not, do it now
695695 if (comp -> num_default_params > 0 && comp -> num_dict_params == 0 ) {
696- EMIT_ARG (build_tuple , comp -> num_default_params );
696+ EMIT_ARG (build , comp -> num_default_params , MP_EMIT_BUILD_TUPLE );
697697 EMIT (load_null ); // sentinel indicating empty default keyword args
698698 }
699699
@@ -1122,7 +1122,7 @@ STATIC void compile_import_from(compiler_t *comp, mp_parse_node_struct_t *pns) {
11221122
11231123 // build the "fromlist" tuple
11241124 EMIT_ARG (load_const_str , MP_QSTR__star_ );
1125- EMIT_ARG (build_tuple , 1 );
1125+ EMIT_ARG (build , 1 , MP_EMIT_BUILD_TUPLE );
11261126
11271127 // do the import
11281128 qstr dummy_q ;
@@ -1141,7 +1141,7 @@ STATIC void compile_import_from(compiler_t *comp, mp_parse_node_struct_t *pns) {
11411141 qstr id2 = MP_PARSE_NODE_LEAF_ARG (pns3 -> nodes [0 ]); // should be id
11421142 EMIT_ARG (load_const_str , id2 );
11431143 }
1144- EMIT_ARG (build_tuple , n );
1144+ EMIT_ARG (build , n , MP_EMIT_BUILD_TUPLE );
11451145
11461146 // do the import
11471147 qstr dummy_q ;
@@ -2397,7 +2397,7 @@ STATIC void compile_atom_paren(compiler_t *comp, mp_parse_node_struct_t *pns) {
23972397STATIC void compile_atom_bracket (compiler_t * comp , mp_parse_node_struct_t * pns ) {
23982398 if (MP_PARSE_NODE_IS_NULL (pns -> nodes [0 ])) {
23992399 // empty list
2400- EMIT_ARG (build_list , 0 );
2400+ EMIT_ARG (build , 0 , MP_EMIT_BUILD_LIST );
24012401 } else if (MP_PARSE_NODE_IS_STRUCT_KIND (pns -> nodes [0 ], PN_testlist_comp )) {
24022402 mp_parse_node_struct_t * pns2 = (mp_parse_node_struct_t * )pns -> nodes [0 ];
24032403 if (MP_PARSE_NODE_IS_STRUCT (pns2 -> nodes [1 ])) {
@@ -2406,12 +2406,12 @@ STATIC void compile_atom_bracket(compiler_t *comp, mp_parse_node_struct_t *pns)
24062406 // list of one item, with trailing comma
24072407 assert (MP_PARSE_NODE_IS_NULL (pns3 -> nodes [0 ]));
24082408 compile_node (comp , pns2 -> nodes [0 ]);
2409- EMIT_ARG (build_list , 1 );
2409+ EMIT_ARG (build , 1 , MP_EMIT_BUILD_LIST );
24102410 } else if (MP_PARSE_NODE_STRUCT_KIND (pns3 ) == PN_testlist_comp_3c ) {
24112411 // list of many items
24122412 compile_node (comp , pns2 -> nodes [0 ]);
24132413 compile_generic_all_nodes (comp , pns3 );
2414- EMIT_ARG (build_list , 1 + MP_PARSE_NODE_STRUCT_NUM_NODES (pns3 ));
2414+ EMIT_ARG (build , 1 + MP_PARSE_NODE_STRUCT_NUM_NODES (pns3 ), MP_EMIT_BUILD_LIST );
24152415 } else if (MP_PARSE_NODE_STRUCT_KIND (pns3 ) == PN_comp_for ) {
24162416 // list comprehension
24172417 compile_comprehension (comp , pns2 , SCOPE_LIST_COMP );
@@ -2424,25 +2424,25 @@ STATIC void compile_atom_bracket(compiler_t *comp, mp_parse_node_struct_t *pns)
24242424 list_with_2_items :
24252425 compile_node (comp , pns2 -> nodes [0 ]);
24262426 compile_node (comp , pns2 -> nodes [1 ]);
2427- EMIT_ARG (build_list , 2 );
2427+ EMIT_ARG (build , 2 , MP_EMIT_BUILD_LIST );
24282428 }
24292429 } else {
24302430 // list with 1 item
24312431 compile_node (comp , pns -> nodes [0 ]);
2432- EMIT_ARG (build_list , 1 );
2432+ EMIT_ARG (build , 1 , MP_EMIT_BUILD_LIST );
24332433 }
24342434}
24352435
24362436STATIC void compile_atom_brace (compiler_t * comp , mp_parse_node_struct_t * pns ) {
24372437 mp_parse_node_t pn = pns -> nodes [0 ];
24382438 if (MP_PARSE_NODE_IS_NULL (pn )) {
24392439 // empty dict
2440- EMIT_ARG (build_map , 0 );
2440+ EMIT_ARG (build , 0 , MP_EMIT_BUILD_MAP );
24412441 } else if (MP_PARSE_NODE_IS_STRUCT (pn )) {
24422442 pns = (mp_parse_node_struct_t * )pn ;
24432443 if (MP_PARSE_NODE_STRUCT_KIND (pns ) == PN_dictorsetmaker_item ) {
24442444 // dict with one element
2445- EMIT_ARG (build_map , 1 );
2445+ EMIT_ARG (build , 1 , MP_EMIT_BUILD_MAP );
24462446 compile_node (comp , pn );
24472447 EMIT (store_map );
24482448 } else if (MP_PARSE_NODE_STRUCT_KIND (pns ) == PN_dictorsetmaker ) {
@@ -2459,7 +2459,7 @@ STATIC void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) {
24592459 bool is_dict ;
24602460 if (!MICROPY_PY_BUILTINS_SET || MP_PARSE_NODE_IS_STRUCT_KIND (pns -> nodes [0 ], PN_dictorsetmaker_item )) {
24612461 // a dictionary
2462- EMIT_ARG (build_map , 1 + n );
2462+ EMIT_ARG (build , 1 + n , MP_EMIT_BUILD_MAP );
24632463 compile_node (comp , pns -> nodes [0 ]);
24642464 EMIT (store_map );
24652465 is_dict = true;
@@ -3040,9 +3040,9 @@ STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
30403040 }
30413041
30423042 if (scope -> kind == SCOPE_LIST_COMP ) {
3043- EMIT_ARG (build_list , 0 );
3043+ EMIT_ARG (build , 0 , MP_EMIT_BUILD_LIST );
30443044 } else if (scope -> kind == SCOPE_DICT_COMP ) {
3045- EMIT_ARG (build_map , 0 );
3045+ EMIT_ARG (build , 0 , MP_EMIT_BUILD_MAP );
30463046 #if MICROPY_PY_BUILTINS_SET
30473047 } else if (scope -> kind == SCOPE_SET_COMP ) {
30483048 EMIT_ARG (build_set , 0 );
0 commit comments