pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:1:   /*   || 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.771 2009/09/12 13:31:37 grubba Exp $ + || $Id: program.c,v 1.772 2009/11/20 10:58:09 grubba Exp $   */      #include "global.h"   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "lex.h"
pike.git/src/program.c:4376:    *    * FIXME: Maybe this can be relaxed by registering a dependency    * and delaying compilation here?    */    yyerror ("Cannot inherit program in pass 2 "    "which is not fully compiled yet.");    yyerror ("(You probably have a cyclic symbol dependency that the "    "compiler cannot handle.)");    }    +  +  if(p->flags & PROGRAM_NEEDS_PARENT) +  { +  struct program_state *state=Pike_compiler; +  +  if(!parent && !parent_offset) +  { +  yyerror("Parent pointer lost, cannot inherit!"); +  /* We've inherited it anyway, to avoid causing more errors */ +  } +  + #if 0 +  /* FIXME: we don't really need to set this flag on ALL +  * previous compilations, but I'm too lazy to figure out +  * exactly how deep down we need to go... +  */ +  for(e=0;e<c->compilation_depth;e++,state=state->previous) +  state->new_program->flags |= PROGRAM_USES_PARENT; + #endif +  } +     return;    }       if (!(p->flags & (PROGRAM_FINISHED | PROGRAM_PASS_1_DONE))) {    yyerror ("Cannot inherit program in pass 1 "    "which is only a placeholder.");    yyerror ("(You probably have a cyclic symbol dependency that the "    "compiler cannot handle.)");    return;    }
pike.git/src/program.c:4397: Inside #if defined(WITH_FACETS)
  #ifdef WITH_FACETS    /* Check if inherit is a facet inherit. */    check_for_facet_inherit(p);   #endif       if (p == placeholder_program) {    yyerror("Trying to inherit placeholder program (resolver problem).");    return;    }    -  if(p->flags & PROGRAM_NEEDS_PARENT) -  { -  struct program_state *state=Pike_compiler; -  -  if(!parent && !parent_offset) -  { -  yyerror("Parent pointer lost, cannot inherit!"); -  /* We inherit it anyway, to avoid causing more errors */ -  } -  - #if 0 -  /* FIXME: we don't really need to set this flag on ALL -  * previous compilations, but I'm too lazy to figure out -  * exactly how deep down we need to go... -  */ -  for(e=0;e<c->compilation_depth;e++,state=state->previous) -  state->new_program->flags |= PROGRAM_USES_PARENT; - #endif -  } -  +     /* parent offset was increased by 42 for above test.. */    if(parent_offset)    parent_offset-=42;       inherit_offset = Pike_compiler->new_program->num_inherits;       /* alignment magic */    storage_offset=p->inherits[0].storage_offset % p->alignment_needed;    storage_offset=low_add_storage(STORAGE_NEEDED(p),    p->alignment_needed,
pike.git/src/program.c:4668:    do_inherit(s,flags,name);    return;    }else{    low_inherit(s->u.program,    0,    numid,    offset+42,    flags,    name);    } +  if (n->token == F_EXTERNAL) { +  struct program *p=program_from_svalue(s); +  if (p->flags & (PROGRAM_NEEDS_PARENT|PROGRAM_NEEDS_PARENT)) { +  /* We'll need the parent pointer as well... */ +  struct program_state *state = Pike_compiler; +  +  while (state && (state->new_program->id != n->u.integer.a)) { +  state->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT; +  state = state->previous; +  } +  } +  }    }else{    yyerror("Inherit identifier is not a constant program");    return;    }    break;       default:    resolv_class(n);    do_inherit(Pike_sp-1, flags, name);    pop_stack();