pike.git / src / las.c

version» Context lines:

pike.git/src/las.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: las.c,v 1.135 1999/12/07 09:40:56 hubbe Exp $"); + RCSID("$Id: las.c,v 1.136 1999/12/09 23:24:10 grubba Exp $");      #include "language.h"   #include "interpret.h"   #include "las.h"   #include "array.h"   #include "object.h"   #include "stralloc.h"   #include "dynamic_buffer.h"   #include "lex.h"   #include "pike_types.h"
pike.git/src/las.c:913:    node *res;       if(!n) return 0;      #ifdef PIKE_DEBUG    if (!type) {    fatal("Soft cast to no type!\n");    }   #endif /* PIKE_DEBUG */    -  if (type == void_type_string) return mknode(F_POP_VALUE, n, 0); +  if (type == void_type_string) { +  yywarning("Soft cast to void."); +  return mknode(F_POP_VALUE, n, 0); +  }    -  if(type==n->type) return n; +  if(type==n->type) { +  struct pike_string *t1 = describe_type(type); +  yywarning("Soft cast to %s is a noop.", t1->str); +  free_string(t1); +  return n; +  }       if (n->type) {    if (!pike_types_le(type, n->type)) {    struct pike_string *t1 = describe_type(type);    struct pike_string *t2 = describe_type(n->type);    yywarning("Soft cast to %s isn't a restriction of %s.",    t1->str, t2->str);    free_string(t2);    free_string(t1);    }
pike.git/src/las.c:1128:    yyerror("Couldn't index module.");    }    push_int(0);    }else{    resolv_constant(n);    switch(sp[-1].type)    {    case T_INT:    if(!num_parse_error) {    if (node_name) { -  my_yyerror("Failed to index module '%s' (module doesn't exist?)", -  node_name); +  my_yyerror("Failed to index module '%s' with '%s' " +  "(module doesn't exist?)", +  node_name, id->str);    } else { -  yyerror("Failed to index module (module doesn't exist?)"); +  my_yyerror("Failed to index module with '%s' " +  "(module doesn't exist?)", +  id->str);    }    }    break;       case T_FLOAT:    case T_STRING:    case T_ARRAY:    if (node_name) {    my_yyerror("Failed to index module '%s' (Not a module?)",    node_name);
pike.git/src/las.c:2396:    } else if(!match_types(CAR(n)->type,mixed_type_string))    yyerror("Bad switch expression.");    copy_shared_string(n->type,void_type_string);    break;       case F_CONSTANT:    n->type = get_type_of_svalue(& n->u.sval);    break;       case F_SSCANF: +  if (!CAR(n) || (CAR(n)->token != F_ARG_LIST) || +  !CAAR(n) || !CDAR(n)) { +  yyerror("Too few arguments to sscanf()."); +  } else { +  if (!pike_types_le(CAAR(n)->type, string_type_string)) { +  if (!match_types(CAAR(n)->type, string_type_string)) { +  yyerror("Bad argument 1 to sscanf()."); +  } else if (lex.pragmas & ID_STRICT_TYPES) { +  struct pike_string *t = describe_type(CAAR(n)->type); +  yywarning("Argument 1 to sscanf() has bad type " +  "(%s expected string).", t->str); +  free_string(t); +  } +  } +  if (!pike_types_le(CDAR(n)->type, string_type_string)) { +  if (!match_types(CDAR(n)->type, string_type_string)) { +  yyerror("Bad argument 2 to sscanf()."); +  } else if (lex.pragmas & ID_STRICT_TYPES) { +  struct pike_string *t = describe_type(CAAR(n)->type); +  yywarning("Argument 2 to sscanf() has bad type " +  "(%s expected string).", t->str); +  free_string(t); +  } +  } +  }    MAKE_CONSTANT_SHARED_STRING(n->type, tIntPos);    break;       case F_UNDEFINED:    MAKE_CONSTANT_SHARED_STRING(n->type, tZero);    break;       case F_ARG_LIST:    if (n->parent) {    /* Propagate the changed type all the way up to the apply node. */
pike.git/src/las.c:2427:    }       if(!CDR(n) || CDR(n)->type==void_type_string)    {    if(CAR(n))    copy_shared_string(n->type,CAR(n)->type);    else    copy_shared_string(n->type,void_type_string);    break;    } +  if (n->token == F_ARG_LIST) { +  n->type = or_pike_types(CAR(n)->type, CDR(n)->type, 0); +  } else { +  copy_shared_string(n->type, CDR(n)->type); +  } +  break;    -  /* FALL_THROUGH */ +     case F_MAGIC_INDEX:    case F_MAGIC_SET_INDEX:    case F_CATCH:    /* FIXME: FALL_THROUGH */    default:    copy_shared_string(n->type,mixed_type_string);    }       if (n->type != old_type) {    if (n->parent) {