+static void function_initvars(params_t*params, int flags)
+{
+ if(state->method->inner)
+ new_variable("this", 0, 0);
+ else if(!state->method->is_global)
+ new_variable((flags&FLAG_STATIC)?"class":"this", state->cls->info, 0);
+ else
+ new_variable("globalscope", 0, 0);
+
+ param_list_t*p=0;
+ for(p=params->list;p;p=p->next) {
+ new_variable(p->param->name, p->param->type, 0);
+ }
+
+ methodstate_list_t*l = state->method->innerfunctions;
+ while(l) {
+ methodstate_t*m = l->methodstate;
+ m->var_index = new_variable(m->info->name, TYPE_FUNCTION(m->info), 0);
+ l = l->next;
+ }
+}
+
+static void innerfunction(char*name, params_t*params, classinfo_t*return_type)
+{
+ parserassert(state->method && state->method->info);
+
+ methodstate_t*parent_method = state->method;
+
+ if(as3_pass==1) {
+ // not valid yet
+ params = 0;
+ return_type = 0;
+ }
+
+ new_state();
+ state->new_vars = 1;
+
+ if(as3_pass == 1) {
+ state->method = rfx_calloc(sizeof(methodstate_t));
+ state->method->inner = 1;
+ state->method->variable_count = 0;
+ state->method->abc = rfx_calloc(sizeof(abc_method_t));
+
+ NEW(memberinfo_t,minfo);
+ minfo->name = name;
+ state->method->info = minfo;
+
+ list_append(parent_method->innerfunctions, state->method);
+
+ dict_put(global->token2info, (void*)(ptroff_t)as3_tokencount, state->method);
+ }
+
+ if(as3_pass == 2) {
+ state->method = dict_lookup(global->token2info, (void*)(ptroff_t)as3_tokencount);
+ parserassert(state->method);
+
+ state->method->info->return_type = return_type;
+ function_initvars(params, 0);
+ }
+}
+