--- parser3/src/main/execute.C 2003/11/20 15:35:31 1.301 +++ parser3/src/main/execute.C 2004/04/06 11:58:15 1.305.6.1 @@ -1,11 +1,11 @@ /** @file Parser: executor part of request class. - Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_EXECUTE_C="$Date: 2003/11/20 15:35:31 $"; +static const char * const IDENT_EXECUTE_C="$Date: 2004/04/06 11:58:15 $"; #include "pa_opcode.h" #include "pa_array.h" @@ -35,12 +35,13 @@ char *opcode_name[]={ "WITH_ROOT", "WITH_SELF", "WITH_READ", "WITH_WRITE", "GET_CLASS", "CONSTRUCT_VALUE", "CONSTRUCT_EXPR", "CURLY_CODE__CONSTRUCT", - "WRITE_VALUE", "WRITE_EXPR_RESULT", "STRING__WRITE", + "WRITE_VALUE", "WRITE_VALUE__EXPLICIT_RESULT", "WRITE_EXPR_RESULT", + "STRING__WRITE", "GET_ELEMENT_OR_OPERATOR", "GET_ELEMENT", "GET_ELEMENT__WRITE", "OBJECT_POOL", "STRING_POOL", "STORE_PARAM", "PREPARE_TO_CONSTRUCT_OBJECT", "PREPARE_TO_EXPRESSION", - "CALL", "CALL__WRITE", + "CALL", "CALL__WRITE", "CALL__WRITE__EXPLICIT_RESULT", // expression ops: unary "NEG", "INV", "NOT", "DEF", "IN", "FEXISTS", "DEXISTS", @@ -91,8 +92,7 @@ void debug_dump(SAPI_Info& sapi_info, in case OP_NESTED_CODE: case OP_OBJECT_POOL: case OP_STRING_POOL: - case OP_CALL: - case OP_CALL__WRITE: + case OP_CALL: case OP_CALL__WRITE: case OP_CALL__WRITE__EXPLICIT_RESULT: if(ArrayOperation* local_ops=i.next().ops) debug_dump(sapi_info, level+1, *local_ops); } @@ -105,7 +105,7 @@ void debug_dump(SAPI_Info& sapi_info, in void Request::execute(ArrayOperation& ops) { register Stack& stack=this->stack; // helps a lot on MSVC: 'esi' - const String* debug_name=0; Operation::Origin debug_origin={0}; + const String* debug_name=0; Operation::Origin debug_origin={0, 0, 0}; try{ #ifdef DEBUG_EXECUTE debug_printf(sapi_info, "source----------------------------\n"); @@ -235,6 +235,13 @@ void Request::execute(ArrayOperation& op write_assign_lang(value); break; } + case OP_WRITE_VALUE__EXPLICIT_RESULT: + { + //todo change me + Value& value=stack.pop().value(); + write_assign_lang(value); + break; + } case OP_WRITE_EXPR_RESULT: { Value& value=stack.pop().value(); @@ -376,6 +383,7 @@ void Request::execute(ArrayOperation& op case OP_CALL: case OP_CALL__WRITE: + case OP_CALL__WRITE__EXPLICIT_RESULT: { //is_debug_junction=true; ArrayOperation* local_ops=i.next().ops; @@ -486,10 +494,24 @@ void Request::execute(ArrayOperation& op rcontext=saved_rcontext; method_frame=saved_method_frame; - if(opcode==OP_CALL__WRITE) { - write_assign_lang(result); - } else { // OP_CALL - stack.push(result.as_value()); + switch(opcode) { + case OP_CALL__WRITE: + write_assign_lang(result); + break; + case OP_CALL: + stack.push(result.as_value()); + break; + default: //case OP_CALL__WRITE__EXPLICIT_RESULT: + if(const String* string=result.get_string()) { + if(!string->is_empty()) + throw Exception("parser.runtime", + 0, + "returned some nonempty string, while it should not (explicit result)"); + } else // result.object + throw Exception("parser.runtime", + 0, + "returned some object, while it should not (explicit result)"); + break; } #ifdef DEBUG_EXECUTE @@ -907,7 +929,7 @@ StringOrValue Request::process(Value& in wcontext=&local; // execute it - recoursion_checked_execute(/*0/*result_name* /, */ *junction->code); + recoursion_checked_execute(*junction->code); // CodeFrame soul: // string writes were intercepted @@ -919,7 +941,7 @@ StringOrValue Request::process(Value& in wcontext=&local; // execute it - recoursion_checked_execute(/*0/*result_name* /, */ *junction->code); + recoursion_checked_execute(*junction->code); result=wcontext->result(); }