pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:7009:      int really_low_find_variant_identifier(struct pike_string *name,    struct program *prog,    struct pike_type *type,    int start_pos,    int flags)   {    struct reference *funp;    struct identifier *fun;    int id, i, depth, last_inh; +  int tentative = -1;      #if 1   #ifdef COMPILER_DEBUG    fprintf(stderr,"th(%ld) %p Trying to find variant \"%s\" start=%d flags=%d\n"    " type: ",    (long)th_self(), prog, name->str, start_pos, flags);    simple_describe_type(type);    fprintf(stderr, "\n");   #endif   #endif
pike.git/src/program.c:7050:    {    funp = prog->identifier_references + i;    if(funp->id_flags & ID_HIDDEN) continue;    if(!(funp->id_flags & ID_VARIANT)) continue;    if(funp->id_flags & ID_PROTECTED)    if(!(flags & SEE_PROTECTED))    continue;    fun = ID_FROM_PTR(prog, funp);    /* if(fun->func.offset == -1) continue; * Prototype */    if(!is_same_string(fun->name,name)) continue; -  if(type && (fun->type != type)) continue; +  if(type && (fun->type != type)) { +  if ((Pike_compiler->pass == 2) && +  !(funp->id_flags & ID_INHERITED) && +  match_types(fun->type, type)) { +  tentative = i; +  } +  continue; +  }    if(funp->id_flags & ID_INHERITED)    {    struct inherit *inh = INHERIT_FROM_PTR(prog, funp);    if ((funp->id_flags & ID_PRIVATE) && !(flags & SEE_PRIVATE)) continue;    if (!depth || (depth > inh->inherit_level)) {    if (id != -1) {    int j;    int min_level = depth;    for (j=last_inh-1; j > funp->inherit_offset; j--) {    struct inherit *inh2 = prog->inherits + j;
pike.git/src/program.c:7083:    }    last_inh = funp->inherit_offset;    depth = inh->inherit_level;    id = i;    }    } else {    CDFPRINTF("Found %d\n", i);    return i;    }    } +  if (id < 0) id = tentative;    CDFPRINTF("Found %d\n", id);    return id;   }      /**    * This is the dispatcher function for variant functions.    *    * cf end_first_pass().    */   static void f_dispatch_variant(INT32 args)