Branch: Tag:

2013-11-03

2013-11-03 18:00:36 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Fixed inherits of deep mixins.

Fixes the long standing [bug 6063].

2317:   }   #endif    - int override_identifier (struct reference *new_ref, struct pike_string *name) + int override_identifier (struct reference *new_ref, struct pike_string *name, +  int required_flags)   {    struct compilation *c = THIS_COMPILATION;    int id = -1, cur_id = 0, is_used = 0;
2348:       if(ref->id_flags & ID_VARIANT) continue;    +  if ((ref->id_flags & required_flags) != required_flags) continue; +     /* Do not zapp functions with the wrong name... */    if((i = ID_FROM_PTR(Pike_compiler->new_program, ref))->name != name)    continue;
2478:    if (ref->id_flags & ID_HIDDEN) continue;    if (ref->id_flags & ID_VARIANT) continue;    if (ref->inherit_offset != 0) continue; -  override_identifier (ref, ID_FROM_PTR (p, ref)->name); +  override_identifier (ref, ID_FROM_PTR (p, ref)->name, 0);    }       /* Ok, sort for binsearch */
3985:    optimize_program(Pike_compiler->new_program);    Pike_compiler->new_program->flags |= PROGRAM_FINISHED;    } +  } else { +  /* All references in prog are now known. +  * Fixup identifier overrides or external symbols, +  * so that inherit is safe. +  */ +  for (e = 0; e < prog->num_identifier_references; e++) { +  struct reference *ref = prog->identifier_references + e; +  if (ref->id_flags & ID_HIDDEN) continue; +  if (ref->inherit_offset != 0) continue; +  override_identifier (ref, ID_FROM_PTR (prog, ref)->name, +  ID_EXTERN);    } -  +  }      #ifdef PIKE_DEBUG    if (prog) {
5673:    }       /* override */ -  if ((overridden = override_identifier (&ref, name)) >= 0) { +  if ((overridden = override_identifier (&ref, name, 0)) >= 0) {   #ifdef PIKE_DEBUG    struct reference *oref =    Pike_compiler->new_program->identifier_references+overridden;
6223:    prog->identifier_references[i] = ref;    overridden = i;    } else { -  overridden = override_identifier(&ref, name); +  overridden = override_identifier(&ref, name, 0);    }    if (overridden >= 0) {   #ifdef PIKE_DEBUG