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.111 1999/11/18 02:46:03 mast Exp $"); + RCSID("$Id: las.c,v 1.112 1999/11/18 16:53:59 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:521:    if(a && a->token == F_CONSTANT &&    a->u.sval.type == T_FUNCTION &&    a->u.sval.subtype == FUNCTION_BUILTIN)    {    res->node_info |= a->u.sval.u.efun->flags;    }else{    res->node_info |= OPT_SIDE_EFFECT | OPT_EXTERNAL_DEPEND; /* for now */    }    break;    +  case F_POP_VALUE: +  copy_shared_string(res->type, void_type_string); +  +  if(a) res->tree_info |= a->tree_info; +  if(b) res->tree_info |= b->tree_info; +  break; +     case F_MAGIC_SET_INDEX:    res->node_info |= OPT_ASSIGNMENT;    /* FALL_THROUGH */    case F_MAGIC_INDEX:    res->node_info |= OPT_EXTERNAL_DEPEND;    break;       case F_UNDEFINED:    res->node_info |= OPT_EXTERNAL_DEPEND | OPT_SIDE_EFFECT;    break;
pike.git/src/las.c:1388:   {    if(!n) return 0;    if(!n->type) return 1;    return type_may_overload(n->type->str, lfun);   }      node **last_cmd(node **a)   {    node **n;    if(!a || !*a) return (node **)NULL; -  if((*a)->token == F_CAST) return last_cmd(&_CAR(*a)); +  if(((*a)->token == F_CAST) || +  ((*a)->token == F_POP_VALUE)) return last_cmd(&_CAR(*a));    if(((*a)->token != F_ARG_LIST) &&    ((*a)->token != F_COMMA_EXPR)) return a;    if(CDR(*a))    { -  if(CDR(*a)->token != F_CAST && CAR(*a)->token != F_ARG_LIST && -  CAR(*a)->token != F_COMMA_EXPR) +  if(CDR(*a)->token != F_CAST && +  CDR(*a)->token != F_POP_VALUE && +  CAR(*a)->token != F_ARG_LIST && /* FIXME: typo? */ +  CAR(*a)->token != F_COMMA_EXPR) /* FIXME: typo? */    return &_CDR(*a);    if((n=last_cmd(&_CDR(*a))))    return n;    }    if(CAR(*a))    { -  if(CAR(*a)->token != F_CAST && CAR(*a)->token != F_ARG_LIST && +  if(CAR(*a)->token != F_CAST && +  CAR(*a)->token != F_POP_VALUE && +  CAR(*a)->token != F_ARG_LIST &&    CAR(*a)->token != F_COMMA_EXPR)    return &_CAR(*a);    if((n=last_cmd(&_CAR(*a))))    return n;    }    return 0;   }      static node **low_get_arg(node **a,int *nr)   {
pike.git/src/las.c:1509:    fprintf(stderr, "trampoline<unknown identifier>");    }    break;       case F_ASSIGN:    low_print_tree(_CDR(foo),1);    fprintf(stderr, "=");    low_print_tree(_CAR(foo),0);    break;    +  case F_POP_VALUE: +  fprintf(stderr, "{"); +  low_print_tree(_CAR(foo), 0); +  fprintf(stderr, "}"); +  break; +     case F_CAST:    {    char *s;    init_buf();    low_describe_type(foo->type->str);    s=simple_free_buf();    fprintf(stderr, "(%s){",s);    free(s);    low_print_tree(_CAR(foo),0);    fprintf(stderr, "}");
pike.git/src/las.c:1876:      static int cntargs(node *n)   {    if(!n) return 0;    switch(n->token)    {    case F_CAST:    case F_APPLY:    return n->type != void_type_string;    +  case F_POP_VALUE:    case F_FOREACH:    case F_INC_NEQ_LOOP:    case F_DEC_NEQ_LOOP:    case F_INC_LOOP:    case F_DEC_LOOP: return 0;       case F_COMMA_EXPR:    case F_VAL_LVAL:    case F_LVALUE_LIST:    case F_ARG_LIST:
pike.git/src/las.c:3228:    case F_LOCAL:    return (!n->u.integer.b && n->u.integer.a==expected) ? expected + 1 : -1;    default:    return -1;    }   }      static int is_null_branch(node *n)   {    if(!n) return 1; -  if(n->token==F_CAST && n->type==void_type_string) +  if((n->token==F_CAST && n->type==void_type_string) || +  n->token == F_POP_VALUE)    return is_null_branch(CAR(n));    if(n->token==F_ARG_LIST)    return is_null_branch(CAR(n)) && is_null_branch(CDR(n));    return 0;   }      static struct svalue *is_stupid_func(node *n,    int args,    int vargs,    struct pike_string *type)
pike.git/src/las.c:3255:       if(n->token == F_ARG_LIST)    {    if(is_null_branch(CAR(n)))    n=CDR(n);    else    n=CAR(n);    continue;    }    -  if(n->token == F_CAST && n->type==void_type_string) +  if((n->token == F_CAST && n->type==void_type_string) || +  n->token == F_POP_VALUE)    {    n=CAR(n);    continue;    }    break;    }       if(!n || n->token != F_RETURN) return 0;    n=CAR(n);