--- parser3/src/main/execute.C 2001/03/10 15:44:31 1.87 +++ parser3/src/main/execute.C 2001/03/11 21:41:04 1.91 @@ -1,5 +1,9 @@ /* - $Id: execute.C,v 1.87 2001/03/10 15:44:31 paf Exp $ + Parser + Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexander Petrosyan (http://design.ru/paf) + + $Id: execute.C,v 1.91 2001/03/11 21:41:04 paf Exp $ */ #include "pa_array.h" @@ -577,7 +581,17 @@ Value *Request::get_element() { return value; } -Value& Request::autocalc(Value& value, const String *name, bool make_string) { +Value& Request::autocalc(Value& value, const String *name, bool intercept_string) { + // intercept_string: + // true: + // they want result=string value, + // possible object result goes to wcontext + // false: + // they want any result[string|object] + // nothing goes to wcontext. + // used in (expression) params evaluation + + Value *result; Junction *junction=value.get_junction(); if(junction && junction->code) { // is it a code-junction? // autocalc it @@ -588,7 +602,7 @@ Value& Request::autocalc(Value& value, c PUSH(wcontext); WContext *frame; - if(make_string) { + if(intercept_string) { // almost plain wwrapper about junction wcontext, // BUT intercepts string writes frame=NEW VCodeFrame(pool(), *junction->wcontext); @@ -602,16 +616,13 @@ Value& Request::autocalc(Value& value, c root=junction->root; rcontext=junction->rcontext; execute(*junction->code); - Value *result; - if(make_string) { + if(intercept_string) { // CodeFrame soul: // string writes were intercepted // returning them as the result of getting code-junction result=NEW VString(*frame->get_string()); } else result=frame->result(); - if(name) - result->set_name(*name); wcontext=static_cast(POP()); rcontext=POP(); @@ -619,9 +630,12 @@ Value& Request::autocalc(Value& value, c self=static_cast(POP()); fprintf(stderr, "<-ja returned"); - return *result; } else - return value; + result=&value; + + if(name) + result->set_name(*name); + return *result; } char *Request::execute_static_method(VClass& vclass, String& method_name, bool return_cstr) {