--- parser3/src/main/execute.C 2008/05/30 12:27:05 1.319 +++ parser3/src/main/execute.C 2008/06/16 12:44:57 1.321 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_EXECUTE_C="$Date: 2008/05/30 12:27:05 $"; +static const char * const IDENT_EXECUTE_C="$Date: 2008/06/16 12:44:57 $"; #include "pa_opcode.h" #include "pa_array.h" @@ -14,8 +14,7 @@ static const char * const IDENT_EXECUTE_ #include "pa_vhash.h" #include "pa_vvoid.h" #include "pa_vcode_frame.h" -#include "pa_vmethod_frame_local.h" -#include "pa_vmethod_frame_global.h" +#include "pa_vmethod_frame.h" #include "pa_vobject.h" #include "pa_vdouble.h" #include "pa_vbool.h" @@ -422,32 +421,17 @@ void Request::execute(ArrayOperation& op value.type()); */ - if(junction->method->all_vars_local){ - VMethodFrameLocal frame(*junction, method_frame); - if(local_ops){ // store param code goes here - stack.push(frame); // argument for *STORE_PARAM ops - execute(*local_ops); - stack.pop().value(); - } - WContext* result_wcontext=op_call(frame); - if(opcode==OP_CALL__WRITE) { - write_assign_lang(result_wcontext->result()); - } else { // OP_CALL - stack.push(result_wcontext->result().as_value()); - } - } else { - VMethodFrameGlobal frame(*junction, method_frame); - if(local_ops){ // store param code goes here - stack.push(frame); // argument for *STORE_PARAM ops - execute(*local_ops); - stack.pop().value(); - } - WContext* result_wcontext=op_call(frame); - if(opcode==OP_CALL__WRITE) { - write_assign_lang(result_wcontext->result()); - } else { // OP_CALL - stack.push(result_wcontext->result().as_value()); - } + VMethodFrame frame(*junction, method_frame); + if(local_ops){ // store param code goes here + stack.push(frame); // argument for *STORE_PARAM ops + execute(*local_ops); + stack.pop().value(); + } + WContext* result_wcontext=op_call(frame); + if(opcode==OP_CALL__WRITE) { + write_assign_lang(result_wcontext->result()); + } else { // OP_CALL + stack.push(result_wcontext->result().as_value()); } #ifdef DEBUG_EXECUTE @@ -869,12 +853,12 @@ Value& Request::get_element(Value& ncont if(read_class->derived_from(*called_class)) // current derived from called if(Value* base=get_self().base()) { // doing DYNAMIC call Temp_derived temp_derived(*base, 0); // temporarily prevent go-back-down virtual calls - value=base->get_element(name, *base, false); // virtual-up lookup starting from parent + value=base->get_element(name, *base, true); // virtual-up lookup starting from parent goto value_ready; } } if(!value) - value=ncontext.get_element(name, ncontext, false); + value=ncontext.get_element(name, ncontext, true); if(value && wcontext->get_constructing()) if(Junction* junction=value->get_junction()) { @@ -907,7 +891,7 @@ void Request::put_element(Value& ncontex 0, "setter method must have ONE parameter (has %d parameters)", param_count); - VMethodFrameGlobal frame(junction, method_frame/*caller*/); + VMethodFrame frame(junction, method_frame/*caller*/); frame.store_param(value); frame.set_self(frame.junction.self); @@ -946,14 +930,21 @@ StringOrValue Request::process(Value& in Junction* junction=input_value.get_junction(); if(junction) { if(junction->is_getter) { // is it a getter-junction? - // process it - - if(junction->method->params_names) + int param_count=junction->method->params_names?junction->method->params_names->count():0; + if(junction->auto_name){ // default getter + if(param_count>1) + throw Exception(PARSER_RUNTIME, + 0, + "default getter method can't have more then 1 parameter (has %d parameters)", param_count); + } else if(param_count) throw Exception(PARSER_RUNTIME, 0, - "getter method must have no parameters"); + "getter method must have no parameters (has %d parameters)", param_count); + + VMethodFrame frame(*junction, method_frame/*caller*/); - VMethodFrameGlobal frame(*junction, method_frame/*caller*/); + if(junction->auto_name && param_count) + frame.store_param(*new VString(*junction->auto_name)); frame.set_self(frame.junction.self); @@ -1067,7 +1058,7 @@ const String* Request::execute_method(Va WContext *saved_wcontext=wcontext; Junction local_junction(aself, &method); - VMethodFrameGlobal local_frame(local_junction, method_frame/*caller*/); + VMethodFrame local_frame(local_junction, method_frame/*caller*/); if(optional_param && local_frame.can_store_param()) { local_frame.store_param(*optional_param); local_frame.fill_unspecified_params();