pike.git / src / las.c

version» Context lines:

pike.git/src/las.c:2228: Inside #if defined(PIKE_DEBUG)
   case F_TRAMPOLINE:    if (Pike_compiler->new_program) {    fprintf(stderr, "trampoline<%s>",    ID_FROM_INT(Pike_compiler->new_program, foo->u.trampoline.ident)->name->str);    } else {    fputs("trampoline<unknown identifier>", stderr);    }    break;       case F_ASSIGN: -  low_print_tree(_CDR(foo),1); +  low_print_tree(_CAR(foo),1);    fputc('=', stderr); -  low_print_tree(_CAR(foo),0); +  low_print_tree(_CDR(foo),0);    break;       case F_ASSIGN_SELF: -  low_print_tree(_CDR(foo),1); +  low_print_tree(_CAR(foo),1);    fputc(':', stderr);    fputc('=', stderr); -  low_print_tree(_CAR(foo),0); +  low_print_tree(_CDR(foo),0);    break;       case F_POP_VALUE:    fputc('{', stderr);    low_print_tree(_CAR(foo), 0);    fputc('}', stderr);    break;       case F_CAST:    {
pike.git/src/las.c:2646: Inside #if defined(PARANOID_INDEXING)
  #ifdef PARANOID_INDEXING    /* Be paranoid, and assume aliasing. */    p->ext_flags = VAR_USED;   #endif /* PARANOID_INDEXING */    if(car_is_node(n)) find_used_variables(CAR(n),p,noblock,0);    if(cdr_is_node(n)) find_used_variables(CDR(n),p,noblock,0);    break;       case F_ASSIGN:    case F_ASSIGN_SELF: -  find_used_variables(CAR(n),p,noblock,0); -  find_used_variables(CDR(n),p,noblock,1); +  find_used_variables(CDR(n),p,noblock,0); +  find_used_variables(CAR(n),p,noblock,1);    break;       case '?':    find_used_variables(CAR(n),p,noblock,0);    a=copy_vars(p);    find_used_variables(CADR(n),a,noblock,0);    find_used_variables(CDDR(n),p,noblock,0);    do_and_vars(p, a);    break;   
pike.git/src/las.c:2772:    case F_INC:    case F_DEC:    case F_POST_INC:    case F_POST_DEC:    find_written_vars(CAR(n), p, 1);    break;       case F_ASSIGN:    case F_ASSIGN_SELF:    case F_MULTI_ASSIGN: -  find_written_vars(CAR(n), p, 0); -  find_written_vars(CDR(n), p, 1); +  find_written_vars(CDR(n), p, 0); +  find_written_vars(CAR(n), p, 1);    break;       case F_APPEND_MAPPING:    case F_APPEND_ARRAY:    find_written_vars(CAR(n), p, 1);    find_written_vars(CDR(n), p, 0);    break;       case F_SSCANF:    find_written_vars(CAR(n), p, 0);
pike.git/src/las.c:3010:   #endif      /* Check if n depends on the lvalue lval */   static int depend2_p(node *n, node *lval)   {    node *tmp;    int ret;       /* Make a temporary node (lval = 0), so that we can use depend_p(). */    ADD_NODE_REF2(lval, -  tmp = mknode(F_ASSIGN, mkintnode(0), lval)); +  tmp = mknode(F_ASSIGN, lval, mkintnode(0)));    ret = depend_p(n, tmp);    free_node(tmp);    return ret;   }      static int function_type_max=0;      void check_foreach_type(node *expression, node *lvalues,    struct pike_type **ind_type,    struct pike_type **val_type )
pike.git/src/las.c:3431:    type_stack_mark();    push_finished_type(CDR(n)->type);    push_type(T_ARRAY);    n->type = and_pike_types(CAR(n)->type, tmp = pop_unfinished_type());    free_type(tmp);    }    break;       case F_ASSIGN:    case F_ASSIGN_SELF: -  if (!CAR(n) || (CAR(n)->type == void_type_string)) { +  if (!CDR(n) || (CDR(n)->type == void_type_string)) {    yyerror("Assigning a void expression.");    copy_pike_type(n->type, void_type_string); -  } else if (!CDR(n)) { -  copy_pike_type(n->type, CAR(n)->type); +  } else if (!CAR(n)) { +  copy_pike_type(n->type, CDR(n)->type);    } else {    /* Ensure that the type-fields are up to date. */    struct pike_type *t; -  fix_type_field(CAR(n)); +     fix_type_field(CDR(n)); -  if( CAR(n)->type->type == PIKE_T_AUTO ) +  fix_type_field(CAR(n)); +  if( CDR(n)->type->type == PIKE_T_AUTO )    {    /* Update to actual type (assign from soft-cast to auto). */ -  free_type( CAR(n)->type ); -  copy_pike_type( CAR(n)->type, CDR(n)->type ); +  free_type( CDR(n)->type ); +  copy_pike_type( CDR(n)->type, CAR(n)->type );       /* potential extension: fix general case:    auto z;    z = 1;    z= 10;       -> typeof(z) == int(1)|int(10)    */    }   #if 0    /* This test isn't sufficient, see below. */ -  check_node_type(CAR(n), CDR(n)->type, "Bad type in assignment."); +  check_node_type(CDR(n), CAR(n)->type, "Bad type in assignment.");   #else /* !0 */ -  if (!pike_types_le(CAR(n)->type, CDR(n)->type)) { +  if (!pike_types_le(CDR(n)->type, CAR(n)->type)) {    /* a["b"]=c and a->b=c can be valid when a is an array.    *    * FIXME: Exactly what case is the problem?    * /grubba 2005-02-15    *    * Example:    * array tmp = ({([]),([])});    * tmp->foo = 7; // Multi-assign.    * /grubba 2007-04-27    */ -  if (((CDR(n)->token != F_INDEX && CDR(n)->token != F_ARROW) || -  !(match_types(array_type_string, CADR(n)->type))) && -  !match_types(CDR(n)->type,CAR(n)->type)) { -  yytype_report(REPORT_ERROR, NULL, 0, CDR(n)->type, -  NULL, 0, CAR(n)->type, +  if (((CAR(n)->token != F_INDEX && CAR(n)->token != F_ARROW) || +  !(match_types(array_type_string, CAAR(n)->type))) && +  !match_types(CAR(n)->type, CDR(n)->type)) { +  yytype_report(REPORT_ERROR, NULL, 0, CAR(n)->type, +  NULL, 0, CDR(n)->type,    0, "Bad type in assignment.");    } else {    if (c->lex.pragmas & ID_STRICT_TYPES) { -  struct pike_string *t1 = describe_type(CAR(n)->type); -  struct pike_string *t2 = describe_type(CDR(n)->type); +  struct pike_string *t1 = describe_type(CDR(n)->type); +  struct pike_string *t2 = describe_type(CAR(n)->type);   #ifdef PIKE_DEBUG    if (l_flag > 0) {    fputs("Warning: Invalid assignment: ", stderr);    print_tree(n);    }   #endif /* PIKE_DEBUG */    yywarning("An expression of type %S cannot be assigned to "    "a variable of type %S.", t1, t2);    free_string(t2);    free_string(t1);    }    if (runtime_options & RUNTIME_CHECK_TYPES) { -  _CAR(n) = mksoftcastnode(CDR(n)->type, -  mkcastnode(mixed_type_string, CAR(n))); +  _CDR(n) = mksoftcastnode(CAR(n)->type, +  mkcastnode(mixed_type_string, CDR(n)));    }    }    }   #endif /* 0 */ -  n->type = and_pike_types(CAR(n)->type, CDR(n)->type); +  n->type = and_pike_types(CDR(n)->type, CAR(n)->type);    }    break;       case F_ARRAY_LVALUE:    {    node *lval_list;    if (!(lval_list = CAR(n))) {    copy_pike_type(n->type, mixed_type_string);    } else {    struct pike_type *t;
pike.git/src/las.c:4055: Inside #if defined(SHARED_NODES) && 0
   const unsigned char *catch_u)   {    if (!n)    return;       fatal_check_c_stack(16384);       switch(n->token) {    case F_ASSIGN:    case F_ASSIGN_SELF: -  if ((CDR(n)->token == F_LOCAL) && (!CDR(n)->u.integer.b)) { -  usage[CDR(n)->u.integer.a] = 0; -  } else if (CDR(n)->token == F_ARRAY_LVALUE) { -  find_usage(CDR(n), usage, switch_u, cont_u, break_u, catch_u); -  } +  if ((CAR(n)->token == F_LOCAL) && (!CDR(n)->u.integer.b)) { +  usage[CAR(n)->u.integer.a] = 0; +  } else if (CAR(n)->token == F_ARRAY_LVALUE) {    find_usage(CAR(n), usage, switch_u, cont_u, break_u, catch_u); -  +  } +  find_usage(CDR(n), usage, switch_u, cont_u, break_u, catch_u);    return;       case F_SSCANF:    {    int i;       /* catch_usage is restored if sscanf throws an error. */    for (i=0; i < MAX_LOCAL; i++) {    usage[i] |= catch_u[i];    }
pike.git/src/las.c:4324: Inside #if defined(SHARED_NODES) && 0
  {    node *car, *cdr;       if (!n)    return NULL;       switch(n->token) {    /* FIXME: Does not support F_LOOP yet. */    case F_ASSIGN:    case F_ASSIGN_SELF: -  if ((CDR(n)->token == F_LOCAL) && (!CDR(n)->u.integer.b)) { +  if ((CAR(n)->token == F_LOCAL) && (!CAR(n)->u.integer.b)) {    /* Assignment of local variable */ -  if (!(usage[CDR(n)->u.integer.a] & 1)) { +  if (!(usage[CAR(n)->u.integer.a] & 1)) {    /* Value isn't used. */    struct pike_type *ref_type;    MAKE_CONSTANT_TYPE(ref_type, tOr(tComplex, tString)); -  if (!match_types(CDR(n)->type, ref_type)) { +  if (!match_types(CAR(n)->type, ref_type)) {    /* The variable doesn't hold a refcounted value. */    free_type(ref_type); -  return low_localopt(CAR(n), usage, switch_u, cont_u, +  return low_localopt(CDR(n), usage, switch_u, cont_u,    break_u, catch_u);    }    free_type(ref_type);    } -  usage[CDR(n)->u.integer.a] = 0; -  cdr = CDR(n); -  ADD_NODE_REF(cdr); -  } else if (CDR(n)->token == F_ARRAY_LVALUE) { -  cdr = low_localopt(CDR(n), usage, switch_u, cont_u, break_u, catch_u); +  usage[CAR(n)->u.integer.a] = 0; +  car = CAR(n); +  ADD_NODE_REF(car); +  } else if (CAR(n)->token == F_ARRAY_LVALUE) { +  car = low_localopt(CAR(n), usage, switch_u, cont_u, break_u, catch_u);    } else { -  cdr = CDR(n); -  ADD_NODE_REF(cdr); +  car = CAR(n); +  ADD_NODE_REF(car);    } -  return mknode(n->token, low_localopt(CAR(n), usage, switch_u, cont_u, -  break_u, catch_u), cdr); +  return mknode(n->token, low_localopt(CDR(n), usage, switch_u, cont_u, +  break_u, catch_u), car);       case F_SSCANF:    {    int i;       /* catch_usage is restored if sscanf throws an error. */    for (i=0; i < MAX_LOCAL; i++) {    usage[i] |= catch_u[i];    }    /* Only the first two arguments are evaluated. */