--- parser3/src/main/execute.C 2004/04/06 11:58:15 1.305.6.1 +++ parser3/src/main/execute.C 2005/08/08 07:44:47 1.306.6.2 @@ -1,11 +1,11 @@ /** @file Parser: executor part of request class. - Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_EXECUTE_C="$Date: 2004/04/06 11:58:15 $"; +static const char * const IDENT_EXECUTE_C="$Date: 2005/08/08 07:44:47 $"; #include "pa_opcode.h" #include "pa_array.h" @@ -35,13 +35,12 @@ char *opcode_name[]={ "WITH_ROOT", "WITH_SELF", "WITH_READ", "WITH_WRITE", "GET_CLASS", "CONSTRUCT_VALUE", "CONSTRUCT_EXPR", "CURLY_CODE__CONSTRUCT", - "WRITE_VALUE", "WRITE_VALUE__EXPLICIT_RESULT", "WRITE_EXPR_RESULT", - "STRING__WRITE", + "WRITE_VALUE", "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__WRITE__EXPLICIT_RESULT", + "CALL", "CALL__WRITE", // expression ops: unary "NEG", "INV", "NOT", "DEF", "IN", "FEXISTS", "DEXISTS", @@ -92,7 +91,8 @@ 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__WRITE__EXPLICIT_RESULT: + case OP_CALL: + case OP_CALL__WRITE: if(ArrayOperation* local_ops=i.next().ops) debug_dump(sapi_info, level+1, *local_ops); } @@ -207,12 +207,12 @@ void Request::execute(ArrayOperation& op debug_printf(sapi_info, " (%d)\n", local_ops.count()); debug_dump(sapi_info, 1, local_ops); #endif - Value& value=*new VJunction(new Junction( + Value& value=*new VJunction( get_self(), 0, method_frame, rcontext, wcontext, - &local_ops)); + &local_ops); const String& name=stack.pop().string(); debug_name=&name; Value& ncontext=stack.pop().value(); @@ -235,13 +235,6 @@ 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(); @@ -357,12 +350,12 @@ void Request::execute(ArrayOperation& op // hence, we zero junction.wcontext here, and later // in .process we would test that field // in decision "which wwrapper to use" - Value& value=*new VJunction(new Junction( + Value& value=*new VJunction( get_self(), 0, method_frame, rcontext, opcode==OP_EXPR_CODE__STORE_PARAM?0:wcontext, - &local_ops)); + &local_ops); // store param // this op is executed from CALL local_ops only, so can not check method_frame_to_fill==0 frame.store_param(value); @@ -383,7 +376,6 @@ 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; @@ -494,24 +486,10 @@ void Request::execute(ArrayOperation& op rcontext=saved_rcontext; method_frame=saved_method_frame; - 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; + if(opcode==OP_CALL__WRITE) { + write_assign_lang(result); + } else { // OP_CALL + stack.push(result.as_value()); } #ifdef DEBUG_EXECUTE @@ -834,7 +812,7 @@ void Request::execute(ArrayOperation& op "invalid opcode %d", opcode); } } - } catch(...) { + } catch(const Exception&) { // record it to stack trace if(debug_name) exception_trace.push(Trace(debug_name, debug_origin)); @@ -850,8 +828,7 @@ Value& Request::get_element(Value& ncont Value* value=0; if(can_call_operator) { if(Method* method=main_class.get_method(name)) // looking operator of that name FIRST - value=new VJunction(new Junction( - main_class, method, 0,0,0, 0)); + value=new VJunction(main_class, method, 0,0,0, 0); } if(!value) { if(!wcontext->get_constructing() // not constructing