@@ -2208,7 +2208,7 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar
22082208 // get first argument to function
22092209 bool found = false;
22102210 for (int i = 0 ; i < comp -> scope_cur -> id_info_len ; i ++ ) {
2211- if (comp -> scope_cur -> id_info [i ].param ) {
2211+ if (comp -> scope_cur -> id_info [i ].flags && ID_FLAG_IS_PARAM ) {
22122212 EMIT_ARG (load_fast , MP_QSTR_ , comp -> scope_cur -> id_info [i ].local_num );
22132213 found = true;
22142214 break ;
@@ -2761,8 +2761,8 @@ void compile_scope_func_lambda_param(compiler_t *comp, mp_parse_node_t pn, pn_ki
27612761 compile_syntax_error (comp , pn , "same name used for parameter" );
27622762 return ;
27632763 }
2764- id_info -> param = true;
27652764 id_info -> kind = ID_INFO_KIND_LOCAL ;
2765+ id_info -> flags |= ID_FLAG_IS_PARAM ;
27662766 }
27672767}
27682768
@@ -3097,7 +3097,7 @@ void compile_scope_compute_things(compiler_t *comp, scope_t *scope) {
30973097 id -> kind = ID_INFO_KIND_GLOBAL_EXPLICIT ;
30983098 }
30993099 // note: params always count for 1 local, even if they are a cell
3100- if (id -> param || id -> kind == ID_INFO_KIND_LOCAL ) {
3100+ if (id -> kind == ID_INFO_KIND_LOCAL || ( id -> flags & ID_FLAG_IS_PARAM ) ) {
31013101 id -> local_num = scope -> num_locals ;
31023102 scope -> num_locals += 1 ;
31033103 }
@@ -3119,7 +3119,7 @@ void compile_scope_compute_things(compiler_t *comp, scope_t *scope) {
31193119 // in Micro Python the cells come right after the fast locals
31203120 // parameters are not counted here, since they remain at the start
31213121 // of the locals, even if they are cell vars
3122- if (! id -> param && id -> kind == ID_INFO_KIND_CELL ) {
3122+ if (id -> kind == ID_INFO_KIND_CELL && !( id -> flags & ID_FLAG_IS_PARAM ) ) {
31233123 id -> local_num = scope -> num_locals ;
31243124 scope -> num_locals += 1 ;
31253125 }
@@ -3136,7 +3136,7 @@ void compile_scope_compute_things(compiler_t *comp, scope_t *scope) {
31363136 for (int j = 0 ; j < scope -> id_info_len ; j ++ ) {
31373137 id_info_t * id2 = & scope -> id_info [j ];
31383138 if (id2 -> kind == ID_INFO_KIND_FREE && id -> qstr == id2 -> qstr ) {
3139- assert (!id2 -> param ); // free vars should not be params
3139+ assert (!( id2 -> flags & ID_FLAG_IS_PARAM ) ); // free vars should not be params
31403140#if MICROPY_EMIT_CPYTHON
31413141 // in CPython the frees are numbered after the cells
31423142 id2 -> local_num = num_cell + num_free ;
@@ -3154,7 +3154,7 @@ void compile_scope_compute_things(compiler_t *comp, scope_t *scope) {
31543154 if (num_free > 0 ) {
31553155 for (int i = 0 ; i < scope -> id_info_len ; i ++ ) {
31563156 id_info_t * id = & scope -> id_info [i ];
3157- if (id -> param || id -> kind != ID_INFO_KIND_FREE ) {
3157+ if (id -> kind != ID_INFO_KIND_FREE || ( id -> flags && ID_FLAG_IS_PARAM ) ) {
31583158 id -> local_num += num_free ;
31593159 }
31603160 }
0 commit comments