--- parser3/src/classes/op.C 2002/09/10 14:56:33 1.107 +++ parser3/src/classes/op.C 2002/09/17 16:16:16 1.109 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_OP_C="$Date: 2002/09/10 14:56:33 $"; +static const char* IDENT_OP_C="$Date: 2002/09/17 16:16:16 $"; #include "classes.h" #include "pa_common.h" @@ -102,15 +102,17 @@ static void _taint(Request& r, const Str static void _process(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); - VStateless_class& self_class=*r.self->get_class(); + VStateless_class *self_class=r.self->get_class(); + if(!self_class) + self_class=new(pool) VStateless_class(pool); // methods storage in case of self abscence const Method *main_method; { // temporary remove language change Temp_lang temp_lang(r, String::UL_PASS_APPENDED); // temporary zero @main so to maybe-replace it in processed code - Temp_method temp_method_main(self_class, r.main_method_name, 0); + Temp_method temp_method_main(*self_class, r.main_method_name, 0); // temporary zero @auto so it wouldn't be auto-called in Request::use_buf - Temp_method temp_method_auto(self_class, *auto_method_name, 0); + Temp_method temp_method_auto(*self_class, *auto_method_name, 0); // evaluate source to process const String& source=r.process_to_string(params->as_junction(0, "body must be code")); @@ -141,10 +143,10 @@ static void _process(Request& r, const S source.cstr(String::UL_UNSPECIFIED, r.connection(0)), *new(pool) String(pool, heap_place, place_size, true /*tainted*/), heap_place, - &self_class); + self_class); // main_method - main_method=self_class.get_method(r.main_method_name); + main_method=self_class->get_method(r.main_method_name); } // after restoring current-request-lang // maybe-execute @main[] @@ -207,14 +209,14 @@ static void _for(Request& r, const Strin for(int i=from; i<=to; i++) { vint->set_int(i); - StringOrValue processed_body=r.process(body_code); - if(delim_maybe_code) { // delimiter set? - const String *string=processed_body.get_string(); - if(need_delim && string && string->size()) // need delim & iteration produced string? + StringOrValue sv_processed=r.process(body_code); + const String *s_processed=sv_processed.get_string(); + if(delim_maybe_code && s_processed && s_processed->size()) { // delimiter set and we have body + if(need_delim) // need delim & iteration produced string? r.write_pass_lang(r.process(*delim_maybe_code)); need_delim=true; } - r.write_pass_lang(processed_body); + r.write_pass_lang(sv_processed); } }