Branch: Tag:

1999-12-03

1999-12-03 02:42:30 by Martin Stjernholm <mast@lysator.liu.se>

Corrected type checking and propagation of void expressions in &&, ||
and ?:.

Rev: src/las.c:1.133

5:   \*/   /**/   #include "global.h" - RCSID("$Id: las.c,v 1.132 1999/11/25 00:56:23 hubbe Exp $"); + RCSID("$Id: las.c,v 1.133 1999/12/03 02:42:30 mast Exp $");      #include "language.h"   #include "interpret.h"
2100:       case F_LAND:    case F_LOR: -  if (!CAR(n) || CAR(n)->type == void_type_string || -  !CDR(n) || CDR(n)->type == void_type_string) { -  yyerror("Conditional contains void expression."); +  if (!CAR(n) || CAR(n)->type == void_type_string) { +  yyerror("Conditional uses void expression.");    copy_shared_string(n->type, mixed_type_string);    break;    }    if(!match_types(CAR(n)->type,mixed_type_string))    yyerror("Bad conditional expression.");    -  if(!match_types(CDR(n)->type,mixed_type_string)) -  yyerror("Bad conditional expression."); -  -  if(CAR(n)->type == CDR(n)->type) +  if (!CDR(n) || CDR(n)->type == void_type_string) +  copy_shared_string(n->type,void_type_string); +  else if(CAR(n)->type == CDR(n)->type)    {    copy_shared_string(n->type,CAR(n)->type);    }else{
2283:    } else if(!match_types(CAR(n)->type,mixed_type_string))    yyerror("Bad conditional expression.");    -  if(!CDR(n) || !CADR(n) || !CDDR(n)) +  if(!CDR(n) || !CADR(n) || !CDDR(n) || +  CADR(n)->type == void_type_string || +  CDDR(n)->type == void_type_string)    {    copy_shared_string(n->type,void_type_string);    break;