+ // store inner methods in variables
+ function_initvars(state->method, 0, 0, 0);
+
+ methodstate_list_t*ml = state->method->innerfunctions;
+ dict_t*xvars = dict_new();
+ while(ml) {
+ methodstate_t*m = ml->methodstate;
+ parserassert(m->inner);
+ if(m->unresolved_variables) {
+ dict_t*d = m->unresolved_variables;
+ int t;
+ for(t=0;t<d->hashsize;t++) {
+ dictentry_t*l = d->slots[t];
+ while(l) {
+ /* check parent method's variables */
+ if(find_variable(state, l->key)) {
+ m->uses_parent_function = 1;
+ state->method->uses_slots = 1;
+ dict_put(xvars, l->key, 0);
+ }
+ l = l->next;
+ }
+ if(l) break;
+ }
+
+ dict_destroy(m->unresolved_variables);
+ m->unresolved_variables = 0;
+ }
+ ml = ml->next;
+ }
+ if(state->method->uses_slots) {
+ state->method->slots = dict_new();
+ int i = 1;
+ DICT_ITERATE_ITEMS(state->vars, char*, name, variable_t*, v) {
+ if(v->index && dict_contains(xvars, name)) {
+ v->init = 0;
+ v->index = i++;
+ if(v->is_inner_method) {
+ v->is_inner_method->is_a_slot = 1;
+ }
+ //v->type = 0;
+ dict_put(state->method->slots, name, v);
+ }
+ }
+ state->method->uses_slots = i;
+ dict_destroy(state->vars);state->vars = 0;
+ }
+ dict_destroy(xvars);
+