From: kramm Date: Fri, 2 Jan 2009 19:53:07 +0000 (+0000) Subject: fixed bug in variable allocation X-Git-Tag: release-0-9-0~448 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=7af2d06662c689c9b0e1e736e4299c030f080a8f fixed bug in variable allocation --- diff --git a/lib/as3/parser.y b/lib/as3/parser.y index 9ed8e40..e678826 100644 --- a/lib/as3/parser.y +++ b/lib/as3/parser.y @@ -887,6 +887,7 @@ static void startfunction(token_t*ns, int flags, enum yytokentype getset, char*n syntaxerror("not able to start another method scope"); } new_state(); + global->variable_count = 0; state->method = rfx_calloc(sizeof(methodstate_t)); state->method->initcode = 0; state->method->has_super = 0; @@ -897,14 +898,11 @@ static void startfunction(token_t*ns, int flags, enum yytokentype getset, char*n new_variable((flags&FLAG_STATIC)?"class":"this", state->cls->info, 0); } else { state->method->is_global = 1; + state->method->late_binding = 1; // for global methods, always push local_0 on the scope stack + new_variable("globalscope", 0, 0); - - /* for global methods, always push local_0 on the scope stack: */ - state->method->late_binding = 1; } - global->variable_count = 0; - /* state->vars is initialized by state_new */ param_list_t*p=0;