Branch: Tag:

1999-11-21

1999-11-21 01:47:41 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Improved type-checking.

Rev: src/las.c:1.123

5:   \*/   /**/   #include "global.h" - RCSID("$Id: las.c,v 1.122 1999/11/21 00:50:30 grubba Exp $"); + RCSID("$Id: las.c,v 1.123 1999/11/21 01:47:41 grubba Exp $");      #include "language.h"   #include "interpret.h"
2146:    n->type = or_pike_types(CADR(n)->type, CDDR(n)->type);    break;    +  case F_RANGE: +  case F_INC: +  case F_DEC: +  case F_POST_INC: +  case F_POST_DEC: +  if (CAR(n)) { +  /* The expression gets the type from the variable. */ +  /* FIXME: Ought to strip non-applicable subtypes from the type. */ +  copy_shared_string(n->type, CAR(n)->type); +  } else { +  copy_shared_string(n->type, mixed_type_string); +  } +  break; +     case F_RETURN:    if (!CAR(n) || (CAR(n)->type == void_type_string)) {    yyerror("Returning a void expression.");
2229:    break;    }    +  case F_SSCANF: +  MAKE_CONSTANT_SHARED_STRING(n->type, tIntPos); +  break; +  +  case F_UNDEFINED: +  MAKE_CONSTANT_SHARED_STRING(n->type, tInt0); +  break; +  +  case F_AND_EQ: +  case F_OR_EQ: +  case F_XOR_EQ: +  case F_LSH_EQ: +  case F_RSH_EQ: +  case F_ADD_EQ: +  case F_SUB_EQ: +  case F_MULT_EQ: +  case F_MOD_EQ: +  case F_DIV_EQ: +  /* FIXME: Go via var = OP(var, expr); to get the type? */ +  /* 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);    }