--- parser3/src/main/execute.C 2009/08/10 12:04:35 1.355 +++ parser3/src/main/execute.C 2009/08/14 23:36:55 1.358 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_EXECUTE_C="$Date: 2009/08/10 12:04:35 $"; +static const char * const IDENT_EXECUTE_C="$Date: 2009/08/14 23:36:55 $"; #include "pa_opcode.h" #include "pa_array.h" @@ -276,7 +276,7 @@ void Request::execute(ArrayOperation& op DEBUG_PRINT_STRING(name) - Value* class_value=classes().get(name); + Value* class_value=get_class(name); if(!class_value) throw Exception(PARSER_RUNTIME, &name, @@ -292,7 +292,7 @@ void Request::execute(ArrayOperation& op wcontext->set_somebody_entered_some_class(); const String& name=stack.pop().string(); - Value* value=classes().get(name); + Value* value=get_class(name); if(!value) throw Exception(PARSER_RUNTIME, &name, @@ -838,7 +838,7 @@ void Request::execute(ArrayOperation& op DEBUG_PRINT_STRING(class_name) - Value* class_value=classes().get(class_name); + Value* class_value=get_class(class_name); if(!class_value) throw Exception(PARSER_RUNTIME, &class_name, @@ -864,7 +864,7 @@ void Request::execute(ArrayOperation& op DEBUG_PRINT_STR("->\n") Junction casted=Junction(*class_value, junction->method); - VMethodFrame frame(casted, method_frame); + VConstructorFrame frame(casted, method_frame); METHOD_FRAME_ACTION(op_call(frame, true /* constructing */)); if(opcode==OP::OP_CONSTRUCT_OBJECT) @@ -1223,9 +1223,7 @@ void Request::op_call(VMethodFrame& fram "is not a constructor, system class '%s' can be constructed only implicitly", called_class.name().cstr()); - frame.write(*new_self, - String::L_CLEAN // not used, always an object, not string - ); + frame.write(*new_self); } else throw Exception(PARSER_RUNTIME, 0, //&frame.name(), @@ -1353,11 +1351,12 @@ StringOrValue Request::process(Value& in if(junction) { if(junction->is_getter) { // is it a getter-junction? VMethodFrame frame(*junction, method_frame/*caller*/); + Value *param; if(size_t param_count=frame.method_params_count()){ if(junction->auto_name){ // default getter if(param_count==1){ - Value *param=new VString(*junction->auto_name); + param=new VString(*junction->auto_name); frame.store_params(¶m, 1); } else throw Exception(PARSER_RUNTIME, @@ -1377,11 +1376,10 @@ StringOrValue Request::process(Value& in method_frame=&frame; recoursion_checked_execute(*frame.junction.method->parser_code); // parser code, execute it - StringOrValue result=wcontext->result(); RESTORE_CONTEXT - return result; + return frame.result(); } if(junction->code) { // is it a code-junction? @@ -1445,11 +1443,12 @@ void Request::process_write(Value& input if(junction) { if(junction->is_getter) { // is it a getter-junction? VMethodFrame frame(*junction, method_frame/*caller*/); + Value *param; if(size_t param_count=frame.method_params_count()){ if(junction->auto_name){ // default getter if(param_count==1){ - Value *param=new VString(*junction->auto_name); + param=new VString(*junction->auto_name); frame.store_params(¶m, 1); } else throw Exception(PARSER_RUNTIME, @@ -1570,15 +1569,13 @@ const String* Request::execute_method(Va // prevent non-string writes for better error reporting if(do_return_string) - wcontext->write(local_frame); + local_frame.write(local_frame); // execute! execute(*method.parser_code); // result - const String* result=0; - if(do_return_string) - result=&wcontext->result().as_string(); + const String* result=do_return_string ? local_frame.get_string() : 0; RESTORE_CONTEXT