Branch: Tag:

2001-12-06

2001-12-06 13:56:05 by Henrik Grubbström (Grubba) <grubba@grubba.org>

No longer possible to index programs and get subclasses that use the parent.
Fixes [bug 2511].

Rev: src/program.c:1.386

5:   \*/   /**/   #include "global.h" - RCSID("$Id: program.c,v 1.385 2001/11/24 23:18:48 mast Exp $"); + RCSID("$Id: program.c,v 1.386 2001/12/06 13:56:05 grubba Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
3948:    }    id = ID_FROM_INT(p, e);    if (IDENTIFIER_IS_CONSTANT(id->identifier_flags)) { +  struct program *p2 = PROG_FROM_INT(p, e); +  struct svalue *val = &p2->constants[id->func.offset].sval; +  if ((val->type != T_PROGRAM) || +  !(val->u.program->flags & PROGRAM_USES_PARENT)) {    ref_push_string(ID_FROM_INT(p, e)->name);    n++;    }    } -  +  }    f_aggregate(n);    res = Pike_sp[-1].u.array;    add_ref(res);
3972:    id = ID_FROM_INT(p, e);    if (IDENTIFIER_IS_CONSTANT(id->identifier_flags)) {    struct program *p2 = PROG_FROM_INT(p, e); -  push_svalue( & p2->constants[id->func.offset].sval); +  struct svalue *val = &p2->constants[id->func.offset].sval; +  if ((val->type != T_PROGRAM) || +  !(val->u.program->flags & PROGRAM_USES_PARENT)) { +  push_svalue(val);    n++;    }    } -  +  }    f_aggregate(n);    res = Pike_sp[-1].u.array;    add_ref(res);
4001:    id=ID_FROM_INT(p, e);    if (IDENTIFIER_IS_CONSTANT(id->identifier_flags)) {    struct program *p2 = PROG_FROM_INT(p, e); -  assign_svalue_no_free(to, ( & p2->constants[id->func.offset].sval)); +  struct svalue *val = &p2->constants[id->func.offset].sval; +  if ((val->type != T_PROGRAM) || +  !(val->u.program->flags & PROGRAM_USES_PARENT)) { +  assign_svalue_no_free(to, val);    return; -  } else { -  if (s->len < 1024) { -  Pike_error("Index \"%s\" is not constant.\n", s->str); -  } else { -  Pike_error("Index is not constant.\n"); +     }    }    }    - #if 1 +     to->type=T_INT;    to->subtype=NUMBER_UNDEFINED;    to->u.integer=0; - #else -  if (s->len < 1024) { -  Pike_error("No such index \"%s\".\n", s->str); -  } else { -  Pike_error("No such index.\n"); +    } - #endif - } +       /*    * Line number support routines, now also tells what file we are in