Branch: Tag:

2013-04-20

2013-04-20 21:04:44 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: low_inherit() now updates parent flags.

Moved update of parent flags (PROGRAM_{NEEDS,USES}_PARENT) from
compiler_do_inherit() to low_inherit(), to help out C-modules
that inherit programs needing parent pointers, since they
typically use low_inherit() directly.

4769:    fun.id_flags |= ID_INHERITED;    add_to_identifier_references(fun);    } +  +  if (parent_offset) { +  if (p->flags & (PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT)) { +  /* We'll need the parent pointer as well... */ +  struct program_state *state = Pike_compiler; +  +  while (state && parent_offset--) { +  state->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT; +  state = state->previous;    } -  +  } +  } + }      PMOD_EXPORT void do_inherit(struct svalue *s,    INT32 flags,
4842:    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;