Branch: Tag:

2008-05-28

2008-05-28 18:55:50 by Henrik Grubbström (Grubba) <grubba@grubba.org>

object_program() now works with subtyped objects where the inherit uses the parent.

Rev: src/builtin_functions.c:1.666

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: builtin_functions.c,v 1.665 2008/05/19 11:31:00 grubba Exp $ + || $Id: builtin_functions.c,v 1.666 2008/05/28 18:55:50 grubba Exp $   */      #include "global.h"
3331:       if(p)    { -  p = p->inherits[Pike_sp[-args].subtype].prog; -  /* FIXME: Does the following actually work for -  * the object subtype case? +  if (Pike_sp[-args].subtype) { +  /* FIXME: This probably works for the subtype-less case as well.    */ -  if((p->flags & PROGRAM_USES_PARENT) && +  struct external_variable_context loc; +  loc.o = o; +  p = (loc.inherit = p->inherits + Pike_sp[-args].subtype)->prog; +  if (p->flags & PROGRAM_USES_PARENT) { +  loc.parent_identifier = loc.inherit->parent_identifier; +  find_external_context(&loc, 1); +  add_ref(loc.o); +  pop_n_elems(args); +  push_function(loc.o, loc.parent_identifier); +  return; +  } +  } else if((p->flags & PROGRAM_USES_PARENT) &&    PARENT_INFO(o)->parent &&    PARENT_INFO(o)->parent->prog)    {
3345:    pop_n_elems(args);    push_function(o, id);    return; -  }else{ +  }    add_ref(p);    pop_n_elems(args);    push_program(p);    return;    }    } -  } +        pop_n_elems(args);    push_int(0);