Branch: Tag:

2003-08-03

2003-08-03 00:59:21 by Martin Stjernholm <mast@lysator.liu.se>

Fixed handling of IDREF_MAGIC_THIS. Fixes for changed behavior in
find_external_context.

Rev: src/interpret_functions.h:1.152
Rev: src/object.c:1.243

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: interpret_functions.h,v 1.151 2003/06/30 17:06:09 mast Exp $ + || $Id: interpret_functions.h,v 1.152 2003/08/03 00:56:46 mast Exp $   */      /*
366:    struct external_variable_context loc;       loc.o=Pike_fp->current_object; -  if(!loc.o->prog) -  Pike_error("Cannot access parent of destructed object.\n"); -  +     loc.parent_identifier=Pike_fp->fun; -  loc.inherit=INHERIT_FROM_INT(loc.o->prog, Pike_fp->fun); -  +  if (loc.o->prog) +  loc.inherit=INHERIT_FROM_INT(loc.o->prog, loc.parent_identifier);    find_external_context(&loc, arg2);       DO_IF_DEBUG({
380:    loc.inherit->identifier_level));    });    +  if (arg1 == IDREF_MAGIC_THIS) +  /* Special treatment to allow doing Foo::this on destructed +  * parent objects. */ +  ref_push_object (loc.o); +  else {    low_object_index_no_free(Pike_sp,    loc.o,    arg1 + loc.inherit->identifier_level);    Pike_sp++; -  +  }    print_return_value();    });   });
393:    struct external_variable_context loc;       loc.o=Pike_fp->current_object; -  if(!loc.o->prog) -  Pike_error("Cannot access parent of destructed object.\n"); -  +     loc.parent_identifier=Pike_fp->fun; -  loc.inherit=INHERIT_FROM_INT(loc.o->prog, Pike_fp->fun); -  +  if (loc.o->prog) +  loc.inherit=INHERIT_FROM_INT(loc.o->prog, loc.parent_identifier);    find_external_context(&loc, arg2);    -  +  if (!loc.o->prog) +  Pike_error ("Cannot access variable in destructed parent object.\n"); +     DO_IF_DEBUG({    TRACE((5,"- Identifier=%d Offset=%d\n",    arg1,    loc.inherit->identifier_level));    });    -  +     ref_push_object(loc.o);    Pike_sp->type=T_OBJ_INDEX;    Pike_sp->u.integer=arg1 + loc.inherit->identifier_level;
2271:   });      OPCODE1(F_THIS_OBJECT, "this_object", 0, { -  if(Pike_fp) -  { +     struct object *o = Pike_fp->current_object;    int level = arg1;    for (; level > 0; level--) {
2286:    o = PARENT_INFO(o)->parent;    }    ref_push_object(o); -  }else{ -  /* Shouldn't this generate an error? /mast */ -  push_int(0); -  } +    });      OPCODE0(F_ZERO_TYPE, "zero_type", 0, {