--- parser3/src/main/execute.C 2002/10/14 12:16:06 1.280 +++ parser3/src/main/execute.C 2002/10/15 10:05:00 1.283 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_EXECUTE_C="$Date: 2002/10/14 12:16:06 $"; +static const char* IDENT_EXECUTE_C="$Date: 2002/10/15 10:05:00 $"; #include "pa_opcode.h" #include "pa_array.h" @@ -398,6 +398,7 @@ void Request::execute(const Array& ops) last_get_element_name, "(%s) not a method or junction, can not call it", value->type()); + /* no check needed, code compiled the way that that's impossible // check: // that this is method-junction, not a code-junction // [disabling these contstructions:] @@ -408,8 +409,9 @@ void Request::execute(const Array& ops) last_get_element_name, "(%s) is code junction, can not call it", value->type()); + */ - VMethodFrame frame(pool(), *last_get_element_name, *junction); + VMethodFrame frame(pool(), *last_get_element_name, *junction, method_frame/*caller*/); if(local_ops){ // store param code goes here PUSH(&frame); // argument for *STORE_PARAM ops execute(*local_ops); @@ -460,19 +462,16 @@ void Request::execute(const Array& ops) method.call_type==Method::CT_ANY || method.call_type==call_type) { // allowed call type? try { + method_frame=&frame; if(method.native_code) { // native code? - // method_frame unchanged, so that ^for ^foreach & co may write to locals method.check_actual_numbered_params( frame.junction.self, frame.name(), frame.numbered_params()); method.native_code( *this, frame.name(), frame.numbered_params()); // execute it - } else { // parser code - method_frame=&frame; - // execute it + } else // parser code, execute it recoursion_checked_execute(&frame.name(), *method.parser_code); - } } catch(...) { // record it to stack trace exception_trace.push((void *)&frame.name()); @@ -835,10 +834,10 @@ Value *Request::get_element(const String Value *ncontext=POP(); Value *value=0; if(can_call_operator) { - if(Method* method=OP.get_method(name)) { // looking operator of that name FIRST + if(Method* method=main_class.get_method(name)) { // looking operator of that name FIRST // as if that method were in self and we have normal dynamic method here Junction& junction=*NEW Junction(pool(), - *main_class, method, 0,0,0,0); + main_class, method, 0,0,0,0); value=NEW VJunction(junction); } } @@ -981,7 +980,7 @@ void Request::execute_method(Value& asel // WWrapper local(pool(), &aself, wcontext); // wcontext=&local; Junction local_junction(pool(), *self, &method, 0,0,0,0); - VMethodFrame local_frame(pool(), method.name, local_junction); + VMethodFrame local_frame(pool(), method.name, local_junction, method_frame/*caller*/); if(optional_param && local_frame.can_store_param()) { local_frame.store_param(optional_param); local_frame.fill_unspecified_params(); @@ -1008,10 +1007,11 @@ void Request::execute_method(Value& asel } void Request::execute_nonvirtual_method(VStateless_class& aclass, - const Method *method, VString *optional_param, + const String& method_name, VString *optional_param, const String **return_string, const Method **return_method) { + const Method *method=aclass.get_method(method_name); if(return_string) *return_string=0; if(return_method)