pike.git
/
src
/
operators.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/operators.c:254:
push_string(s); apply_low(o, f, 1); f=!UNSAFE_IS_ZERO(sp-1); pop_stack(); if(f) return; } } Pike_error("Cast failed, wanted int, got %s\n", get_name_of_type(TYPEOF(sp[-1]))); }
+
else if(SUBTYPEOF(sp[-1]) == NUMBER_UNDEFINED)
+
Pike_error("Cannot cast this object to int.\n");
} break; case T_FLOAT: if ( #ifdef HAVE_ISINF isinf(sp[-1].u.float_number) || #endif #ifdef HAVE_ISNAN
pike.git/src/operators.c:335:
int f = FIND_LFUN(o->prog->inherits[SUBTYPEOF(sp[-1])].prog, LFUN_CAST); if(f == -1) Pike_error("No cast method in object.\n"); push_constant_text("string"); apply_low(o, f, 1); stack_pop_keep_top(); } if(TYPEOF(sp[-1]) != PIKE_T_STRING) {
+
if(TYPEOF(sp[-1])==PIKE_T_INT && SUBTYPEOF(sp[-1])==NUMBER_UNDEFINED)
+
Pike_error("Cannot cast this object to string.\n");
if(TYPEOF(sp[-1]) == T_OBJECT && sp[-1].u.object->prog) { struct object *o = sp[-1].u.object; int f = FIND_LFUN(o->prog->inherits[SUBTYPEOF(sp[-1])].prog, LFUN__IS_TYPE); if( f != -1) { REF_MAKE_CONST_STRING(s, "string"); push_string(s); apply_low(o, f, 1);
pike.git/src/operators.c:718:
return; } default: Pike_error("Cannot cast %s to a program.\n", get_name_of_type(TYPEOF(sp[-1]))); } } }
+
if(TYPEOF(sp[-1]) == T_INT &&
+
SUBTYPEOF(sp[-1]) == NUMBER_UNDEFINED)
+
Pike_error("Cannot cast this object to %s.\n",
+
get_name_of_type(type->type));
+
if(run_time_type != TYPEOF(sp[-1])) { switch(TYPEOF(sp[-1])) { case T_OBJECT: if(sp[-1].u.object->prog) { struct object *o = sp[-1].u.object; int f = FIND_LFUN(o->prog->inherits[SUBTYPEOF(sp[-1])].prog, LFUN__IS_TYPE); if( f != -1)