From 7af2d06662c689c9b0e1e736e4299c030f080a8f Mon Sep 17 00:00:00 2001 From: kramm Date: Fri, 2 Jan 2009 19:53:07 +0000 Subject: [PATCH] fixed bug in variable allocation --- lib/as3/parser.y | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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; -- 1.7.10.4