|
|
| version 1.263, 2002/09/02 14:59:48 | version 1.271, 2002/09/17 16:00:46 |
|---|---|
| Line 111 void debug_dump(Pool& pool, int level, c | Line 111 void debug_dump(Pool& pool, int level, c |
| #define POP_NAME() static_cast<Value *>(stack.pop())->as_string() | #define POP_NAME() static_cast<Value *>(stack.pop())->as_string() |
| #define POP_CODE() static_cast<Array *>(stack.pop()) | #define POP_CODE() static_cast<Array *>(stack.pop()) |
| void Request::execute(const Array& ops, bool clean_junctions) { | void Request::execute(const Array& ops) { |
| // _asm int 3; | // _asm int 3; |
| #ifdef DEBUG_EXECUTE | #ifdef DEBUG_EXECUTE |
| debug_printf(pool(), "source----------------------------\n"); | debug_printf(pool(), "source----------------------------\n"); |
| Line 166 void Request::execute(const Array& ops, | Line 166 void Request::execute(const Array& ops, |
| } | } |
| case OP_WITH_SELF: | case OP_WITH_SELF: |
| { | { |
| if(!self) | |
| throw Exception("parser.runtime", | |
| 0, | |
| "you do not have 'self' here, use local variables"); | |
| PUSH(self); | PUSH(self); |
| break; | break; |
| } | } |
| Line 208 void Request::execute(const Array& ops, | Line 212 void Request::execute(const Array& ops, |
| debug_dump(pool(), 1, *local_ops); | debug_dump(pool(), 1, *local_ops); |
| #endif | #endif |
| Junction& j=*NEW Junction(pool(), | Junction& j=*NEW Junction(pool(), |
| *self, 0, 0, | self, 0, |
| method_frame, | method_frame, |
| rcontext, | rcontext, |
| wcontext, | wcontext, |
| Line 286 void Request::execute(const Array& ops, | Line 290 void Request::execute(const Array& ops, |
| WContext *saved_wcontext=wcontext; | WContext *saved_wcontext=wcontext; |
| uchar saved_lang= flang; | uchar saved_lang= flang; |
| flang=String::UL_PASS_APPENDED; | flang=String::UL_PASS_APPENDED; |
| WWrapper local(pool(), 0 /*empty*/); | WWrapper local(pool(), 0 /*empty*/, wcontext); |
| wcontext=&local; | wcontext=&local; |
| execute(*local_ops); | execute(*local_ops); |
| Line 303 void Request::execute(const Array& ops, | Line 307 void Request::execute(const Array& ops, |
| const Array *local_ops=reinterpret_cast<const Array *>(i.next()); | const Array *local_ops=reinterpret_cast<const Array *>(i.next()); |
| WContext *saved_wcontext=wcontext; | WContext *saved_wcontext=wcontext; |
| WWrapper local(pool(), 0 /*empty*/); | WWrapper local(pool(), 0 /*empty*/, wcontext); |
| wcontext=&local; | wcontext=&local; |
| execute(*local_ops); | execute(*local_ops); |
| Line 348 void Request::execute(const Array& ops, | Line 352 void Request::execute(const Array& ops, |
| // in .process we would test that field | // in .process we would test that field |
| // in decision "which wwrapper to use" | // in decision "which wwrapper to use" |
| Junction& j=*NEW Junction(pool(), | Junction& j=*NEW Junction(pool(), |
| *self, 0, 0, | self, 0, |
| method_frame, | method_frame, |
| rcontext, | rcontext, |
| op.code==OP_EXPR_CODE__STORE_PARAM?0:wcontext, | op.code==OP_EXPR_CODE__STORE_PARAM?0:wcontext, |
| Line 408 void Request::execute(const Array& ops, | Line 412 void Request::execute(const Array& ops, |
| Value *saved_rcontext=rcontext; | Value *saved_rcontext=rcontext; |
| WContext *saved_wcontext=wcontext; | WContext *saved_wcontext=wcontext; |
| VStateless_class *called_class=frame.junction.self.get_class(); | VStateless_class *called_class=frame.junction.self?frame.junction.self->get_class():0; |
| if(wcontext->get_constructing()) { | if(wcontext->get_constructing()) { |
| wcontext->set_constructing(false); | wcontext->set_constructing(false); |
| if(frame.junction.method->call_type!=Method::CT_STATIC) { | if(frame.junction.method->call_type!=Method::CT_STATIC) { |
| Line 431 void Request::execute(const Array& ops, | Line 435 void Request::execute(const Array& ops, |
| &frame.name(), | &frame.name(), |
| "method is static and can not be used as constructor"); | "method is static and can not be used as constructor"); |
| } else | } else |
| self=&frame.junction.self; | self=frame.junction.self; |
| frame.set_self(*self); | frame.set_self(self); |
| // see OP_PREPARE_TO_EXPRESSION | // see OP_PREPARE_TO_EXPRESSION |
| frame.set_in_expression(wcontext->get_in_expression()); | frame.set_in_expression(wcontext->get_in_expression()); |
| Line 806 Value *Request::get_element(const String | Line 810 Value *Request::get_element(const String |
| if(Method* method=OP.get_method(name)) { // looking operator of that name FIRST | if(Method* method=OP.get_method(name)) { // looking operator of that name FIRST |
| // as if that method were in self and we have normal dynamic method here | // as if that method were in self and we have normal dynamic method here |
| Junction& junction=*NEW Junction(pool(), | Junction& junction=*NEW Junction(pool(), |
| *method_frame, self->get_class(), method, 0,0,0,0); | method->native_code?method_frame/*for ^process*/:0, method, 0,0,0,0); |
| value=NEW VJunction(junction); | value=NEW VJunction(junction); |
| } | } |
| } | } |
| Line 864 StringOrValue Request::process(Value& in | Line 868 StringOrValue Request::process(Value& in |
| Value *saved_rcontext=rcontext; | Value *saved_rcontext=rcontext; |
| WContext *saved_wcontext=wcontext; | WContext *saved_wcontext=wcontext; |
| self=&junction->self; | self=junction->self; |
| method_frame=junction->method_frame; | method_frame=junction->method_frame; |
| rcontext=junction->rcontext; | rcontext=junction->rcontext; |
| Line 875 StringOrValue Request::process(Value& in | Line 879 StringOrValue Request::process(Value& in |
| if(using_code_frame) { | if(using_code_frame) { |
| // almost plain wwrapper about junction wcontext, | // almost plain wwrapper about junction wcontext, |
| // BUT intercepts string writes | // BUT intercepts string writes |
| VCodeFrame local(pool(), *junction->wcontext); | VCodeFrame local(pool(), *junction->wcontext, junction->wcontext); |
| wcontext=&local; | wcontext=&local; |
| // execute it | // execute it |
| Line 887 StringOrValue Request::process(Value& in | Line 891 StringOrValue Request::process(Value& in |
| result.set_string(*wcontext->get_string()); | result.set_string(*wcontext->get_string()); |
| } else { | } else { |
| // plain wwrapper | // plain wwrapper |
| WWrapper local(pool(), 0/*empty*/); | WWrapper local(pool(), 0/*empty*/, wcontext); |
| wcontext=&local; | wcontext=&local; |
| // execute it | // execute it |
| Line 945 void Request::execute_method(Value& asel | Line 949 void Request::execute_method(Value& asel |
| // initialize contexts | // initialize contexts |
| //method_frame=rcontext=self=&aself; | //method_frame=rcontext=self=&aself; |
| self=&aself; | self=&aself; |
| // WWrapper local(pool(), &aself); | // WWrapper local(pool(), &aself, wcontext); |
| // wcontext=&local; | // wcontext=&local; |
| Junction local_junction(pool(), *self, self->get_class(), &method, 0,0,0,0); | Junction local_junction(pool(), self, &method, 0,0,0,0); |
| VMethodFrame local_frame(pool(), method.name, local_junction); | VMethodFrame local_frame(pool(), method.name, local_junction); |
| if(optional_param && local_frame.can_store_param()) { | if(optional_param && local_frame.can_store_param()) { |
| local_frame.store_param(optional_param); | local_frame.store_param(optional_param); |
| local_frame.fill_unspecified_params(); | local_frame.fill_unspecified_params(); |
| } | } |
| local_frame.set_self(*self); | local_frame.set_self(self); |
| rcontext=wcontext=method_frame=&local_frame; | rcontext=wcontext=method_frame=&local_frame; |
| // prevent non-string writes for better error reporting | // prevent non-string writes for better error reporting |