|
|
| version 1.73, 2001/03/08 15:15:46 | version 1.78, 2001/03/08 17:14:53 |
|---|---|
| Line 274 void Request::execute(const Array& ops) | Line 274 void Request::execute(const Array& ops) |
| PUSH(wcontext); | PUSH(wcontext); |
| VClass *called_class=frame->junction.self.get_class(); | VClass *called_class=frame->junction.self.get_class(); |
| // constructing? | // is context object or class & is it my class or my parent's class? |
| if(wcontext->constructing()) { // yes | VClass *read_class=rcontext->get_class(); |
| // constructor call: $some(^class:method(..)) | if(read_class && read_class->is_or_derived_from(*called_class)) // yes |
| self=NEW VObject(pool(), *called_class); | self=rcontext; // class dynamic call |
| frame->write(*self); | else // no, not me or relative of mine (total stranger) |
| } else { // no | if(wcontext->constructing()) { // constructing? |
| // context is object or class & is it my class or my parent's class? | // yes, constructor call: $some(^class:method(..)) |
| VClass *read_class=rcontext->get_class(); | self=NEW VObject(*called_class); |
| if(read_class && read_class->is_or_derived_from(*called_class)) // yes | frame->write(*self); |
| self=rcontext; // class dynamic call | } else |
| else // no | self=&frame->junction.self; // no, static or simple dynamic call |
| self=&frame->junction.self; // static or simple dynamic call | |
| } | |
| frame->set_self(*self); | frame->set_self(*self); |
| root=rcontext=wcontext=frame; | root=rcontext=wcontext=frame; |
| { | { |
| Line 317 void Request::execute(const Array& ops) | Line 316 void Request::execute(const Array& ops) |
| case OP_NEG: | case OP_NEG: |
| { | { |
| Value *operand=POP(); | Value *operand=POP(); |
| Value *value=NEW VDouble(pool(), -operand->get_double()); | Value *value=NEW VDouble(pool(), |
| -operand->get_double()); | |
| PUSH(value); | PUSH(value); |
| break; | break; |
| } | } |
| Line 362 void Request::execute(const Array& ops) | Line 362 void Request::execute(const Array& ops) |
| case OP_SUB: | case OP_SUB: |
| { | { |
| Value *b=POP(); Value *a=POP(); | Value *b=POP(); Value *a=POP(); |
| Value *value=NEW VDouble(pool(), a->get_double() - b->get_double()); | Value *value=NEW VDouble(pool(), |
| a->get_double() - b->get_double()); | |
| PUSH(value); | PUSH(value); |
| break; | break; |
| } | } |
| case OP_ADD: | case OP_ADD: |
| { | { |
| Value *b=POP(); Value *a=POP(); | Value *b=POP(); Value *a=POP(); |
| Value *value=NEW VDouble(pool(), a->get_double() + b->get_double()); | Value *value=NEW VDouble(pool(), |
| a->get_double() + b->get_double()); | |
| PUSH(value); | PUSH(value); |
| break; | break; |
| } | } |
| case OP_MUL: | case OP_MUL: |
| { | { |
| Value *b=POP(); Value *a=POP(); | Value *b=POP(); Value *a=POP(); |
| Value *value=NEW VDouble(pool(), a->get_double() * b->get_double()); | Value *value=NEW VDouble(pool(), |
| a->get_double() * b->get_double()); | |
| PUSH(value); | PUSH(value); |
| break; | break; |
| } | } |
| case OP_DIV: | case OP_DIV: |
| { | { |
| Value *b=POP(); Value *a=POP(); | Value *b=POP(); Value *a=POP(); |
| Value *value=NEW VDouble(pool(), a->get_double() / b->get_double()); | Value *value=NEW VDouble(pool(), |
| a->get_double() / b->get_double()); | |
| PUSH(value); | PUSH(value); |
| break; | break; |
| } | } |
| Line 543 Value *Request::get_element() { | Line 547 Value *Request::get_element() { |
| Value *ncontext=POP(); | Value *ncontext=POP(); |
| Value *value=ncontext->get_element(name); | Value *value=ncontext->get_element(name); |
| // autocalc possible code-junction | if(value) |
| value=value?&autocalc(*value):NEW VUnknown(pool()); | value=&autocalc(*value); // autocalc possible code-junction |
| else { | |
| value=NEW VUnknown(pool()); | |
| value->set_name(name); | |
| } | |
| value->set_name(name); | |
| return value; | return value; |
| } | } |