Branch: Tag:

2001-09-28

2001-09-28 23:18:56 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

fix for [bug 1858 (#1858)] (this_object() in constants) and [bug 721 (#721)] (bug with final and inherit) backported from Pike 7.3

Rev: src/array.c:1.104
Rev: src/array.h:1.32
Rev: src/compilation.h:1.22
Rev: src/mapping.c:1.122
Rev: src/mapping.h:1.36
Rev: src/multiset.c:1.33
Rev: src/multiset.h:1.17
Rev: src/program.c:1.304
Rev: src/svalue.c:1.104
Rev: src/svalue.h:1.77

5:   \*/   /**/   #include "global.h" - RCSID("$Id: mapping.c,v 1.121 2001/09/05 03:56:43 hubbe Exp $"); + RCSID("$Id: mapping.c,v 1.122 2001/09/28 23:18:53 hubbe Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"
1637:       mapping_fix_type_field(m);    -  if((m->data->ind_types | m->data->val_types) & (BIT_FUNCTION | BIT_OBJECT)) +  if(!mapping_is_constant(m,0))    {    struct array *ind, *val;    node *n;
2331:    /* free_mapping(m); */    }   } +  +  + int mapping_is_constant(struct mapping *m, +  struct processing *p) + { +  INT32 e; +  struct keypair *k; +  struct mapping_data *md=m->data; +  +  if( (md->ind_types | md->val_types) & ~(BIT_INT|BIT_FLOAT|BIT_STRING)) +  { +  md->valrefs++; +  add_ref(md); +  NEW_MAPPING_LOOP(md) +  { +  if(!svalues_are_constant(&k->ind, 1, md->ind_types, p)) return 0; +  if(!svalues_are_constant(&k->val, 1, md->val_types, p)) return 0; +  } +  md->valrefs--; +  free_mapping_data(md); +  } +  return 1; + }