--- parser3/src/classes/op.C 2002/10/15 09:42:41 1.116 +++ parser3/src/classes/op.C 2002/10/15 10:58:34 1.118 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_OP_C="$Date: 2002/10/15 09:42:41 $"; +static const char* IDENT_OP_C="$Date: 2002/10/15 10:58:34 $"; #include "classes.h" #include "pa_common.h" @@ -96,6 +96,7 @@ static void _taint(Request& r, const Str static void _process(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); const Method *main_method; + VStateless_class *target_class; { Value& vjunction=params->as_junction(params->size()-1, "body must be code"); @@ -108,7 +109,7 @@ static void _process(Request& r, const S &method_name, "no caller"); // can't be, somebody really called ^process - VStateless_class *target_class=vtarget->get_class(); + target_class=vtarget->get_class(); if(!target_class) throw Exception("parser.runtime", &method_name, @@ -158,6 +159,10 @@ static void _process(Request& r, const S // after restoring current-request-lang // maybe-execute @main[] if(main_method) { + // temporarily set request's self to target_class + Temp_request_self trs(r, *target_class); + // temporarily set method_frame's self to target_class + Temp_method_frame_self tmfs(*r.get_method_frame(), *target_class); // execute! r.execute(*main_method->parser_code); } @@ -212,7 +217,7 @@ static void _for(Request& r, const Strin bool need_delim=false; VInt *vint=new(pool) VInt(pool, 0); - r.get_method_frame()->put_element(var_name, vint, false); + r.get_method_frame()->caller()->put_element(var_name, vint, false); for(int i=from; i<=to; i++) { vint->set_int(i);