Branch: Tag:

2008-05-03

2008-05-03 15:51:50 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Simulate inherits in second pass.
Fixes LysLysKOM 16472935.

Rev: src/compilation.h:1.36
Rev: src/language.yacc:1.417
Rev: src/program.c:1.684
Rev: src/testsuite.in:1.803

2:   || 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.683 2008/05/03 15:29:25 nilsson Exp $ + || $Id: program.c,v 1.684 2008/05/03 15:51:50 grubba Exp $   */      #include "global.h"
1571:    SEE_STATIC|SEE_PRIVATE);    if(i!=-1)    { +  if ((p->flags & COMPILATION_FORCE_RESOLVE) && +  (p->compiler_pass == 2) && +  ((p->num_inherits + 1) < p->new_program->num_inherits) && +  (PTR_FROM_INT(p->new_program, i)->inherit_offset > +  p->num_inherits)) { +  /* Don't look up symbols inherited later, when looking up +  * inherits... +  */ +  continue; +  }    return p == Pike_compiler ?    mkidentifiernode(i) :    mkexternalnode(p->new_program, i);
4199:    return;    }    +  if (Pike_compiler->compiler_pass == 2) { +  struct program *old_p = +  Pike_compiler->new_program->inherits[Pike_compiler->num_inherits+1].prog; +  Pike_compiler->num_inherits += old_p->num_inherits; +  if (old_p != p) { +  yyerror("Got different program for inherit in second pass."); +  } +  return; +  } +    #ifdef WITH_FACETS    /* Check if inherit is a facet inherit. */    check_for_facet_inherit(p);
6866:    }       push_svalue(&thrown); +  /* safe_apply_current(PC_FILTER_EXCEPTION_FUN_NUM, 1); */    low_safe_apply_handler("compile_exception", c->handler, c->compat_handler, 1);       if (SAFE_IS_ZERO(sp-1)) {
7376:    }   }    + /*! @decl int filter_exception(SeverityLevel level, mixed err) +  */ + static void f_compilation_env_filter_exception(INT32 args) + { +  int level; +  struct svalue *err; +  +  get_all_args("filter_exception", args, "%d%*", &level, &err); +  if (args > 2) { +  pop_n_elems(args-2); +  args = 2; +  } +  +  if (level >= REPORT_WARNING) { +  if (level >= REPORT_ERROR) { +  APPLY_MASTER("compile_exception", 1); +  } else { +  push_int(level); +  push_string(format_exception_for_error_msg(err)); +  } +  } + } +    /*! @class PikeCompiler    *!    *! The Pike compiler.