pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:2033:    * -1 global::    * -2 ::    */   struct node_s *find_inherited_identifier(struct program_state *inherit_state,    int inherit_depth, int inh,    struct pike_string *ident)   {    int id;       if (inh < -1) { -  // Unspecified inherit. +  /* Unspecified inherit, but not inherit #0. */    struct node_s *res = NULL;    struct program *p = inherit_state->new_program; -  +  assert(!inherit_depth);    for (inh = 1; inh < p->num_inherits; inh++) { -  struct node_s *n; +     if (p->inherits[inh].inherit_level != 1) continue; -  n = find_inherited_identifier(inherit_state, inherit_depth, inh, ident); -  if (!n) continue; +  /* NB: We can't recurse here, as that would resolve the magic +  * identifiers multiple times on multiple inherit. +  */ +  id = low_reference_inherited_identifier(inherit_state, inh, ident, +  SEE_PROTECTED); +  if (id == -1) continue;    if (res) { -  res = mknode(F_ARG_LIST, res, n); +  res = mknode(F_ARG_LIST, res, mkidentifiernode(id));    } else { -  res = n; +  res = mkidentifiernode(id);    }    }    if (res) {    if (res->token == F_ARG_LIST) res = mkefuncallnode("aggregate", res);    return res;    }    inh = -1;    } else {    if (inh > 0) {    /* Specified inherit. */    id = low_reference_inherited_identifier(inherit_state, inh, ident,    SEE_PROTECTED);    } else { -  /* this_program:: or global:: */ +  /* this_program:: (0) or global:: (-1). */    id = really_low_find_shared_string_identifier(ident,    inherit_state->new_program,    SEE_PROTECTED|SEE_PRIVATE);    }       if (id != -1) {    if (inherit_depth > 0) {    return mkexternalnode(inherit_state->new_program, id);    }    return mkidentifiernode(id);