Branch: Tag:

1999-12-30

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

Keep the type in eval() if it's stricter than the type of the result.

Rev: src/las.c:1.155

5:   \*/   /**/   #include "global.h" - RCSID("$Id: las.c,v 1.154 1999/12/29 19:20:32 grubba Exp $"); + RCSID("$Id: las.c,v 1.155 1999/12/30 21:36:02 mast Exp $");      #include "language.h"   #include "interpret.h"
3671:      static node *eval(node *n)   { +  node *new;    int args;    extern struct svalue *sp;    if(!is_const(n) || n->token==':')
3697:    return n;    }    if (n->token != F_SOFT_CAST) { -  free_node(n); -  n=mksvaluenode(sp-1); +  new = mksvaluenode(sp-1);    } else { -  node *nn = n; -  n = mksoftcastnode(n->type, mksvaluenode(sp-1)); -  free_node(nn); +  new = mksoftcastnode(n->type, mksvaluenode(sp-1));    } -  +  if (n->type && (!new->type || pike_types_le(n->type,new->type))) { +  if (new->type) free_string(new->type); +  copy_shared_string(new->type,n->type); +  } +  free_node(n); +  n = new;    pop_stack();    break;