pike.git / src / interpreter.h

version» Context lines:

pike.git/src/interpreter.h:1304:    struct pike_string *sval_type = get_type_of_svalue(sp-1);    if (!pike_types_le(sval_type, sp[-2].u.string)) {    /* get_type_from_svalue() doesn't return a fully specified type    * for array, mapping and multiset, so we perform a more lenient    * check for them.    */    if (!pike_types_le(sval_type, weak_type_string) ||    !match_types(sval_type, sp[-2].u.string)) {    struct pike_string *t1;    struct pike_string *t2; +  char *fname = "soft_cast";    ONERROR tmp1;    ONERROR tmp2;    -  +  if (fp->current_object && fp->context.prog && +  fp->current_object->prog) { +  /* Look up the function-name */ +  struct pike_string *name = +  ID_FROM_INT(fp->current_object->prog, fp->fun)->name; +  if (!name->size_shift) +  fname = name->str; +  } +     t1 = describe_type(sp[-2].u.string);    SET_ONERROR(tmp1, do_free_string, t1);       t2 = describe_type(sval_type);    SET_ONERROR(tmp2, do_free_string, t2);       free_string(sval_type);    -  bad_arg_error("soft_cast", sp-1, 1, 1, t1->str, sp-1, -  "Assertion failed in soft_cast(). " -  "Expected %s, got %s\n", -  t1->str, t2->str); +  bad_arg_error(fname, sp-1, 1, 1, t1->str, sp-1, +  "%s(): Soft cast failed. Expected %s, got %s\n", +  fname, t1->str, t2->str);    /* NOT_REACHED */    UNSET_ONERROR(tmp2);    UNSET_ONERROR(tmp1);    free_string(t2);    free_string(t1);    }    }    free_string(sval_type);   #ifdef PIKE_DEBUG    if (d_flag > 2) {