Branch: Tag:

2014-07-11

2014-07-11 15:33:55 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Runtime: Increased strictness of variant dispatcher.

The variant dispatcher regarded all objects (even those without `()())
as callable. This was not a good idea.

Fixes some of the issues with the Crypto.RSA testsuite.

6154:    case PIKE_T_PROGRAM:    case PIKE_T_FUNCTION:    case T_MANY: +  { +  struct pike_type *t = NULL;    /* Identify if sval is callable. */ -  +  if (TYPEOF(*sval) == PIKE_T_OBJECT) { +  struct program *p; +  int f; +  struct identifier *id; +  if (!sval->u.object || !(p = sval->u.object->prog)) break; +  p = p->inherits[SUBTYPEOF(*sval)].prog; +  if ((f = FIND_LFUN(p, LFUN_CALL)) == -1) break; +  id = ID_FROM_INT(p, f); +  t = id->type; +  res = 1; +  } else {    res =    (TYPEOF(*sval) == T_FUNCTION) ||    (TYPEOF(*sval) == T_PROGRAM) ||    (TYPEOF(*sval) == T_ARRAY) || -  (TYPEOF(*sval) == T_OBJECT) || +     (TYPEOF(*sval) == T_TYPE); -  +  }    /* FIXME: Check arguments */    /* FIXME: Check return type */ -  +  }    break;    case PIKE_T_MIXED:    res = 1;