- abc_method_t*f = 0;
-
- multiname_t*type2 = sig2mname(return_type);
- int slot = 0;
- if(state->method->is_constructor) {
- f = abc_class_getconstructor(state->cls->abc, type2);
- } else if(!state->method->is_global) {
- namespace_t mname_ns = flags2namespace(flags, "");
- multiname_t mname = {QNAME, &mname_ns, 0, name};
-
- if(flags&FLAG_STATIC)
- f = abc_class_staticmethod(state->cls->abc, type2, &mname);
- else
- f = abc_class_method(state->cls->abc, type2, &mname);
- slot = f->trait->slot_id;
- } else {
- namespace_t mname_ns = flags2namespace(flags, state->package);
- multiname_t mname = {QNAME, &mname_ns, 0, name};
-
- f = abc_method_new(global->file, type2, 1);
- trait_t*t = trait_new_method(&global->init->traits, multiname_clone(&mname), f);
- //abc_code_t*c = global->init->method->body->code;
- }
- //flash doesn't seem to allow us to access function slots
- //state->method->info->slot = slot;
-
- if(flags&FLAG_OVERRIDE) f->trait->attributes |= TRAIT_ATTR_OVERRIDE;
- if(getset == KW_GET) f->trait->kind = TRAIT_GETTER;
- if(getset == KW_SET) f->trait->kind = TRAIT_SETTER;
- if(params->varargs) f->flags |= METHOD_NEED_REST;
-
- char opt=0;
- param_list_t*p=0;
- for(p=params->list;p;p=p->next) {
- if(params->varargs && !p->next) {
- break; //varargs: omit last parameter in function signature
- }
- multiname_t*m = sig2mname(p->param->type);
- list_append(f->parameters, m);
- if(p->param->value) {
- check_constant_against_type(p->param->type, p->param->value);
- opt=1;list_append(f->optional_parameters, p->param->value);
- } else if(opt) {
- syntaxerror("non-optional parameter not allowed after optional parameters");
+ if(as3_pass==1) {
+ // store inner methods in variables
+ function_initvars(state->method, 0, 0, 0);
+
+ methodstate_list_t*ml = state->method->innerfunctions;
+ 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;
+ break;
+ }
+ l = l->next;
+ }
+ if(l) break;
+ }
+
+ dict_destroy(m->unresolved_variables);
+ m->unresolved_variables = 0;
+ }
+ ml = ml->next;