--- parser3/src/main/execute.C 2002/01/24 17:18:48 1.209 +++ parser3/src/main/execute.C 2002/01/31 12:40:35 1.211 @@ -4,7 +4,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://paf.design.ru) - $Id: execute.C,v 1.209 2002/01/24 17:18:48 paf Exp $ + $Id: execute.C,v 1.211 2002/01/31 12:40:35 paf Exp $ */ #include "pa_opcode.h" @@ -166,7 +166,7 @@ void Request::execute(const Array& ops) case OP_GET_CLASS: { // maybe they do ^class:method[] call, remember the fact - wcontext->set_somebody_entered_some_class(); + wcontext->set_somebody_entered_some_class(true); const String& name=POP_NAME(); value=static_cast(classes().get(name)); @@ -209,6 +209,11 @@ void Request::execute(const Array& ops) Value *ncontext=POP(); ncontext->put_element(name, value); value->set_name(name); + + // forget the fact they've entered some $class/object.xxx + // see OP_GET_ELEMENT + wcontext->set_somebody_entered_some_object(false); + wcontext->set_somebody_entered_some_class(false); break; } case OP_CONSTRUCT_EXPR: @@ -256,9 +261,10 @@ void Request::execute(const Array& ops) value=POP(); write_assign_lang(*value); - // forget the fact they've entered some ^object.method[]. + // forget the fact they've entered some ^object/class.xxx or $object/class.xxx // see OP_GET_ELEMENT wcontext->set_somebody_entered_some_object(false); + wcontext->set_somebody_entered_some_class(false); break; } case OP_WRITE_EXPR_RESULT: @@ -279,11 +285,14 @@ void Request::execute(const Array& ops) case OP_GET_ELEMENT: { + //_asm int 3; + // uses entered object/class flags to plug in operators + value=get_element(); + // maybe they do ^object.method[] call, remember the fact + // must be below get_element() call, it checks it wcontext->set_somebody_entered_some_object(true); - //_asm int 3; - value=get_element(); PUSH(value); break; } @@ -788,7 +797,11 @@ Value *Request::get_element() { const String& name=POP_NAME(); Value *ncontext=POP(); Value *value=ncontext->get_element(name); - if(!value) + // operators can not be in form... + if(!value && + !wcontext->get_somebody_entered_some_class () && // $class:xxx + !wcontext->get_somebody_entered_some_object()) // $object.xxx + // they can only be in form ^xxx or $xxx if(Method* method=OP.get_method(name)) { // maybe operator? // as if that method were in self and we have normal dynamic method here Junction& junction=*NEW Junction(pool(),