Branch: Tag:

2014-08-18

2014-08-18 15:38:59 by Martin Nilsson <nilsson@opera.com>

Improved cast.

22:   #include "module_support.h"   #include "threads.h"   #include "gc.h" + #include "pike_types.h"      /* __attribute__ only applies to function declarations, not    definitions, so we disable them here. */
624:    */   static void f_error_cast(INT32 args)   { -  char *s; -  get_all_args("error->cast",args,"%s",&s); -  if(!strncmp(s,"array",5)) +  if(Pike_sp[-1].u.string == literal_array_string)    { -  pop_n_elems(args); +  pop_stack();    apply_current (generic_err_message_fun, 0);    apply_current (generic_err_backtrace_fun, 0);    f_aggregate(2); -  }else{ -  SIMPLE_BAD_ARG_ERROR("error->cast", 1, "the value \"array\""); +     } -  +  else +  { +  pop_stack(); +  push_undefined();    } -  + }      /*! @decl array|string `[](int(0..1) index)    *!