--- parser3/src/main/execute.C 2001/03/27 16:35:54 1.128 +++ parser3/src/main/execute.C 2001/03/27 18:24:38 1.131 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: execute.C,v 1.128 2001/03/27 16:35:54 paf Exp $ + $Id: execute.C,v 1.131 2001/03/27 18:24:38 paf Exp $ */ #include "pa_config_includes.h" @@ -93,7 +93,7 @@ void dump(Pool& pool, int level, const A Value *value=static_cast(ops.quick_get(++i)); log_printf(pool, " \"%s\" %s", value->get_string()->cstr(), value->type()); } - log_printf(pool, "\n"); + //\log_printf(pool, "\n"); if(op.code==OP_CURLY_CODE__STORE_PARAM || op.code==OP_EXPR_CODE__STORE_PARAM) { const Array *local_ops=reinterpret_cast(ops.quick_get(++i)); @@ -134,16 +134,27 @@ void Request::execute(const Array& ops) log_printf(pool(), " (%d)\n", local_ops->size()); dump(pool(), 1, *local_ops); + // when called method of some object, specifying object literally, + // e.g ^t.menu, code of curly params must be executed + // in r/w context of that object. + // otherwise in current r/w context. + // // when they evaluate expression parameter, // the object expression result // does not need to be written into calling frame // it must go into any expressions using that parameter // hence, zeroing junction.wcontext being created - // later, in .process would test that field + // later, in .process we would test that field // in decision "which wwrapper to use" Junction& j=*NEW Junction(pool(), *self, 0, 0, - root, frame, op.code==OP_EXPR_CODE__STORE_PARAM?0:frame, local_ops); + root, + wcontext->somebody_entered_some_object()>1? + &frame->junction.self /* ^t.menu{} */:rcontext/* ^if() */, + op.code==OP_EXPR_CODE__STORE_PARAM? + 0:wcontext->somebody_entered_some_object()>1? + frame/* ^t.menu{} */:wcontext/* ^if() */, + local_ops); Value *value=NEW VJunction(j); @@ -153,7 +164,7 @@ void Request::execute(const Array& ops) } case OP_GET_CLASS: { - // maybe the do ^class:method[] call, remember the fact + // maybe they do ^class:method[] call, remember the fact wcontext->set_somebody_entered_some_class(); const String& name=POP_NAME(); @@ -230,6 +241,9 @@ void Request::execute(const Array& ops) case OP_GET_ELEMENT: { + // maybe they do ^object.method[] call, remember the fact + wcontext->inc_somebody_entered_some_object(); + Value *value=get_element(); PUSH(value); break; @@ -617,7 +631,7 @@ void Request::execute(const Array& ops) 0, "unhandled '%s' opcode", opcode_name[op.code]); } - log_printf(pool(), "\n"); + //\log_printf(pool(), "\n"); } } @@ -655,7 +669,7 @@ Value& Request::process(Value& value, co PUSH(self); PUSH(root); PUSH(rcontext); - PUSH(wcontext); + PUSH(wcontext); WContext *frame; // for expression method params