Branch: Tag:

2003-06-04

2003-06-04 09:09:23 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Bugfix in the new low_start_new_program().

Rev: src/program.c:1.504

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: program.c,v 1.503 2003/06/03 18:02:28 mast Exp $ + || $Id: program.c,v 1.504 2003/06/04 09:09:23 grubba Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.503 2003/06/03 18:02:28 mast Exp $"); + RCSID("$Id: program.c,v 1.504 2003/06/04 09:09:23 grubba Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
1844:    compilation_depth);   #endif    } -  if(compilation_depth >= 1) -  add_ref(p->parent = Pike_compiler->new_program); +     }else{    tmp.u.program=p;    add_ref(p); -  if(name) +  if((pass == 2) && name)    {    struct identifier *i;    id=isidentifier(name);
1860:    i->type=get_type_of_svalue(&tmp);    }    } +  if (pass == 1) { +  if(compilation_depth >= 1) +  add_ref(p->parent = Pike_compiler->new_program); +  }    p->flags &=~ PROGRAM_VIRGIN;    Pike_compiler->parent_identifier=id;    if(idp) *idp=id;
2321: Inside #if defined(PIKE_DEBUG)
  {    int d;    +  if (!p) { +  fprintf(stderr, "%*sProgram: NULL\n\n", indent, ""); +  return; +  } +     fprintf(stderr,    "%*sProgram flags: 0x%04x\n\n",    indent, "", p->flags);
3910:    low_add_storage(sizeof_variable(run_time_type),    alignof_variable(run_time_type),0),    run_time_type); +     ID_FROM_INT(Pike_compiler->new_program, n)->identifier_flags |= IDENTIFIER_NO_THIS_REF;       return n;
4509:    return i;   }    + #if 0 +  + int add_ext_ref(struct program_state *state, struct program *target, int i) + { +  struct reference ref, *r; +  int j; +  if (state->new_program == target) return i; +  i = add_ext_ref(state->previous, target, i); +  for (r = state->new_program->identifier_references, j = 0; +  j < state->new_program->num_identifier_references; +  j++, r++) { +  if (((r->id_flags & ID_PARENT_REF|ID_STATIC|ID_PRIVATE|ID_HIDDEN) == +  ID_PARENT_REF|ID_STATIC|ID_PRIVATE|ID_HIDDEN) && +  (r->identifier_offset == i) && +  (!(r->inherit_offset))) { +  return j; +  } +  } +  ref.id_flags = ID_PARENT_REF|ID_STATIC|ID_PRIVATE|ID_HIDDEN; +  ref.identifier_offset = i; +  ref.inherit_offset = 0; +  add_to_identifier_references(ref); +  state->new_program->flags |= PROGRAM_USES_PARENT | PROGRAM_NEEDS_PARENT; +  return j; + } +  + #endif /* 0 */ +    /* Identifier lookup    *    * The search algorithm has changed several times during Pike 7.3.