+#define parserassert(b) {if(!(b)) parsererror(__FILE__, __LINE__,__func__);}
+
+static void parsererror(const char*file, int line, const char*f)
+{
+ syntaxerror("internal error in %s, %s:%d", f, file, line);
+}
+
+
+code_t* method_header()
+{
+ code_t*c = 0;
+ if(state->method->late_binding && !state->method->inner) {
+ c = abc_getlocal_0(c);
+ c = abc_pushscope(c);
+ }
+ /*if(state->method->innerfunctions) {
+ c = abc_newactivation(c);
+ c = abc_pushscope(c);
+ }*/
+ if(state->method->is_constructor && !state->method->has_super) {
+ // call default constructor
+ c = abc_getlocal_0(c);
+ c = abc_constructsuper(c, 0);
+ }
+ methodstate_list_t*l = state->method->innerfunctions;
+ while(l) {
+ parserassert(l->methodstate->abc);
+ c = abc_newfunction(c, l->methodstate->abc);
+ c = abc_setlocal(c, l->methodstate->var_index);
+ free(l->methodstate);l->methodstate=0;
+ l = l->next;
+ }
+ list_free(state->method->innerfunctions);
+ state->method->innerfunctions = 0;
+ return c;
+}
+
+