pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:1:   /*   || 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.473 2003/06/30 17:18:24 mast Exp $ + || $Id: program.c,v 1.474 2003/08/18 15:11:38 mast Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.473 2003/06/30 17:18:24 mast Exp $"); + RCSID("$Id: program.c,v 1.474 2003/08/18 15:11:38 mast Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "language.h"   #include "lex.h"   #include "pike_macros.h"   #include "fsort.h"
pike.git/src/program.c:1110:    }    END_CYCLIC();    if(ret) return ret;    }       return 0;   }      /*! @decl constant this    *! -  *! Builtin constant that evaluates to the current object. +  *! Builtin read only variable that evaluates to the current object.    *!    *! @seealso    *! @[this_program], @[this_object()]    */      /*! @decl constant this_program    *!    *! Builtin constant that evaluates to the current program.    *!    *! @seealso
pike.git/src/program.c:1143: Inside #if 0
  {   #if 0    fprintf (stderr, "magic_identifier (state, %d, %d, %s, %d)\n",    state_depth, inherit_num, ident->str, colon_colon_ref);   #endif       if (!inherit_num) {    /* These are only recognized when looking in the current program    * and not an inherited one. */    -  /* Handle this */ -  if (ident == this_string) -  return mkefuncallnode ("this_object", mknewintnode (state_depth)); +  /* Handle this by referring to the magic this identifier at index 0. */ +  if (ident == this_string) { +  if (state_depth > 0) +  return mkexternalnode (state->new_program, IDREF_MAGIC_THIS); +  else +  return mkidentifiernode (IDREF_MAGIC_THIS); +  }       /* Handle this_program */ -  if (ident == this_program_string) -  return mkefuncallnode ("object_program", -  mkefuncallnode ("this_object", -  mknewintnode (state_depth))); +  if (ident == this_program_string) { +  node *n = mkefuncallnode ("object_program", +  state_depth > 0 ? +  mkexternalnode (state->new_program, IDREF_MAGIC_THIS) : +  mkidentifiernode (IDREF_MAGIC_THIS)); +  /* We know this expression is constant. */ +  n->node_info &= ~OPT_NOT_CONST; +  n->tree_info &= ~OPT_NOT_CONST; +  return n;    } -  +  }       if (colon_colon_ref) {    /* These are only recognized when prefixed with the :: operator. */       if (inherit_num < 0) inherit_num = 0;    if(ident == lfun_strings[LFUN_ARROW] ||    ident == lfun_strings[LFUN_INDEX]) {    return mknode(F_MAGIC_INDEX, mknewintnode(inherit_num),    mknewintnode(state_depth));    } else if(ident == lfun_strings[LFUN_ASSIGN_ARROW] ||
pike.git/src/program.c:3320:    if (!state) {    yyerror("Failed to resolv external constant.\n");    return;    }    p = state->new_program;    numid = n->u.integer.b;    }       continue_inherit:    -  i=ID_FROM_INT(p, numid); -  -  if(IDENTIFIER_IS_CONSTANT(i->identifier_flags)) +  if(numid != IDREF_MAGIC_THIS && +  (i=ID_FROM_INT(p, numid), IDENTIFIER_IS_CONSTANT(i->identifier_flags)))    {    struct svalue *s=&PROG_FROM_INT(p, numid)->    constants[i->func.offset].sval;    if(s->type != T_PROGRAM)    {    do_inherit(s,flags,name);    return;    }else{    p=s->u.program;    }
pike.git/src/program.c:7045:    }       if((Pike_fp->fun & 0xffff) == 0xffff)    Pike_error("Cannot access parent storage!\n");       loc.parent_identifier=Pike_fp->fun;    loc.inherit=INHERIT_FROM_INT(p, Pike_fp->fun);       find_external_context(&loc, depth);    +  if (!loc.o->prog) +  Pike_error ("Cannot access storage of destructed parent object.\n"); +     return loc.o->storage + loc.inherit->storage_offset;   }      PMOD_EXPORT void change_compiler_compatibility(int major, int minor)   {    STACK_LEVEL_START(0);       if(major == PIKE_MAJOR_VERSION && minor == PIKE_MINOR_VERSION)    {    push_int(0); /* optimization */