Branch: Tag:

2003-08-03

2003-08-03 02:34:46 by Martin Stjernholm <mast@lysator.liu.se>

Adapted this_object() to the fact that it doesn't always access the
lexically surrounding parent objects.

Rev: src/builtin_functions.c:1.499
Rev: src/interpret_functions.h:1.153

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.152 2003/08/03 00:56:46 mast Exp $ + || $Id: interpret_functions.h,v 1.153 2003/08/03 02:34:46 mast Exp $   */      /*
2274:      OPCODE1(F_THIS_OBJECT, "this_object", 0, {    struct object *o = Pike_fp->current_object; -  int level = arg1; -  for (; level > 0; level--) { +  int level; +  for (level = 0; level < arg1; level++) {    struct program *p = o->prog;    if (!p) -  Pike_error ("Cannot get the parent object of a destructed object.\n"); -  DO_IF_DEBUG ( +  Pike_error ("Object %d level(s) up is destructed - cannot get the parent.\n", +  level);    if (!(p->flags & PROGRAM_USES_PARENT)) -  Pike_fatal ("optimize_this_object failed to set up parent pointers.\n"); -  ); +  /* FIXME: Ought to write out the object here. */ +  Pike_error ("Object %d level(s) up lacks parent reference.\n", level);    o = PARENT_INFO(o)->parent;    }    ref_push_object(o);