abc_method_t*abc;
int var_index; // for inner methods
+ int slot_index; // for inner methods
char is_a_slot; // for inner methods
code_t*header;
c = abc_newfunction(c, l->methodstate->abc);
c = abc_dup(c);
c = abc_setlocal(c, l->methodstate->var_index);
- c = abc_setslot(c, l->methodstate->var_index);
+ c = abc_setslot(c, l->methodstate->slot_index);
} else {
c = abc_newfunction(c, l->methodstate->abc);
c = abc_setlocal(c, l->methodstate->var_index);
}
if(m->uses_slots) {
/* as variables and slots share the same number, make sure
- that those variable indices are reserved */
+ that those variable indices are reserved. It's up to the
+ optimizer to later shuffle the variables down to lower
+ indices */
m->variable_count = m->uses_slots;
}
methodstate_t*m = l->methodstate;
variable_t* v = new_variable2(m->info->name, TYPE_FUNCTION(m->info), 0, 1);
m->var_index = v->index;
+ m->slot_index = v->index;
v->is_inner_method = m;
l = l->next;
}
code_t*j2 = $$.c = abc_jump($$.c, 0);
$$.c = j1->branch = abc_label($$.c);
$$.c = code_append($$.c, $5.c);
- $$.c = converttype($$.c, $3.t, $$.t);
+ $$.c = converttype($$.c, $5.t, $$.t);
$$.c = j2->branch = abc_label($$.c);
}