pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: pike_types.c,v 1.358 2008/09/12 15:21:41 grubba Exp $ + || $Id: pike_types.c,v 1.359 2009/03/04 14:28:42 grubba Exp $   */      #include "global.h"   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"   #include "stralloc.h"   #include "stuff.h"   #include "array.h"   #include "program.h"
pike.git/src/pike_types.c:3198:    case PIKE_T_NAME:    case PIKE_T_ATTRIBUTE:    return low_match_types(a->cdr, b, flags);       case T_NOT:    if(low_match_types(a->car, b, (flags ^ B_EXACT ) | NO_MAX_ARGS))    return 0;    return a;       case T_ASSIGN: -  ret = low_match_types(a->cdr, b, flags); -  if(ret && (b->type != T_VOID)) +     {    int m = CAR_TO_INT(a); -  +  ret = low_match_types(a->cdr, b, flags); +  if(ret && (!a_markers[m] || b->type != T_VOID)) +  {    struct pike_type *tmp;      #ifdef PIKE_DEBUG    if ((m < 0) || (m > 9)) {    Pike_fatal("marker out of range: %d\n", m);    }   #endif /* PIKE_DEBUG */       type_stack_mark();    push_finished_type_with_markers(b, b_markers, 0);
pike.git/src/pike_types.c:3242: Inside #if defined(PIKE_TYPE_DEBUG)
   fprintf(stderr,"%s",(s=simple_free_buf(&save_buf)));    free(s);    }   #endif   #ifdef PIKE_DEBUG    if(a_markers[m]->type == m+'0')    Pike_fatal("Cyclic type!\n");   #endif    }    return ret; -  +  }    case '0': case '1': case '2': case '3': case '4':    case '5': case '6': case '7': case '8': case '9':    {    int m = a->type - '0';    if(a_markers[m])    {    struct pike_type *t = a_markers[m];    struct pike_type *res;   #ifdef PIKE_DEBUG    if(a_markers[m]->type == a->type)
pike.git/src/pike_types.c:3307:    case PIKE_T_NAME:    case PIKE_T_ATTRIBUTE:    return low_match_types(a, b->cdr, flags);       case T_NOT:    if(low_match_types(a, b->car, (flags ^ A_EXACT ) | NO_MAX_ARGS))    return 0;    return a;       case T_ASSIGN: -  ret = low_match_types(a, b->cdr, flags); -  if(ret && (a->type != T_VOID)) +     {    int m = CAR_TO_INT(b); -  +  ret = low_match_types(a, b->cdr, flags); +  if(ret && (!b_markers[m] || a->type != T_VOID)) +  {    struct pike_type *tmp;       type_stack_mark();    push_finished_type_with_markers(a, a_markers, 0);    tmp=pop_unfinished_type();       type_stack_mark();    low_or_pike_types(b_markers[m], tmp, 0);    if(b_markers[m]) free_type(b_markers[m]);    free_type(tmp);
pike.git/src/pike_types.c:3344: Inside #if defined(PIKE_TYPE_DEBUG)
   fprintf(stderr,"%s",(s=simple_free_buf(&save_buf)));    free(s);    }   #endif   #ifdef PIKE_DEBUG    if(b_markers[m]->type == m+'0')    Pike_fatal("Cyclic type!\n");   #endif    }    return ret; -  +  }    case '0': case '1': case '2': case '3': case '4':    case '5': case '6': case '7': case '8': case '9':    {    int m = b->type - '0';    if(b_markers[m])    {    struct pike_type *t = b_markers[m];    struct pike_type *res;   #ifdef PIKE_DEBUG    if(b_markers[m]->type == b->type)
pike.git/src/pike_types.c:3878: Inside #if 0 and #if defined(TYPE_GROUPING)
   flags ^= LE_A_B_GROUPED;    }    } else {    flags |= LE_A_B_GROUPED;    }   #endif   #endif    /* FIXME: This is wrong... */    return !low_pike_types_le(b, a->car, -array_cnt, flags);    -  case T_ASSIGN: +  case T_ASSIGN: { +  struct pike_type **aa_markers = a_markers; +  struct pike_type **bb_markers = b_markers; +  int m = CAR_TO_INT(a);    ret = low_pike_types_le(a->cdr, b, array_cnt, flags); -  if(ret && (b->type != T_VOID)) +  +  if (flags & LE_A_B_SWAPPED) { +  aa_markers = b_markers; +  bb_markers = a_markers; +  } +  +  if(ret && (!aa_markers[m] || (b->type != T_VOID)))    { -  int m = CAR_TO_INT(a); +     struct pike_type *tmp;    int i;       type_stack_mark(); -  if (flags & LE_A_B_SWAPPED) { -  push_finished_type_with_markers(b, a_markers, 0); -  } else { -  push_finished_type_with_markers(b, b_markers, 0); -  } +  push_finished_type_with_markers(b, bb_markers, 0);    for(i=array_cnt; i > 0; i--)    push_type(T_ARRAY);    tmp=pop_unfinished_type();       type_stack_mark(); -  if (flags & LE_A_B_SWAPPED) { -  low_or_pike_types(b_markers[m], tmp, 0); -  if(b_markers[m]) free_type(b_markers[m]); +  low_or_pike_types(aa_markers[m], tmp, 0); +  if(aa_markers[m]) free_type(aa_markers[m]);    free_type(tmp); -  b_markers[m] = pop_unfinished_type(); -  } else { -  low_or_pike_types(a_markers[m], tmp, 0); -  if(a_markers[m]) free_type(a_markers[m]); -  free_type(tmp); -  a_markers[m] = pop_unfinished_type(); -  } +  aa_markers[m] = pop_unfinished_type();   #ifdef PIKE_TYPE_DEBUG    if (l_flag>2) {    if (flags & LE_A_B_SWAPPED) {    fprintf(stderr, "%*sb_markers[%c]=",    indent * 2, "", (char)(m+'0'));    simple_describe_type(b_markers[m]);    } else {    fprintf(stderr, "%*sa_markers[%c]=",    indent * 2, "", (char)(m+'0'));    simple_describe_type(a_markers[m]);    }    fprintf(stderr, "\n");    }   #endif    }    return ret; -  +  }    case '0': case '1': case '2': case '3': case '4':    case '5': case '6': case '7': case '8': case '9':    {    int m = a->type - '0';    if (flags & LE_A_B_SWAPPED) {    if(b_markers[m]) {    a = b_markers[m];    } else {    a = mixed_type_string;    }
pike.git/src/pike_types.c:4042: Inside #if defined(TYPE_GROUPING)
   if ((flags & LE_A_B_GROUPED) == LE_A_B_GROUPED) {    flags ^= LE_A_B_GROUPED;    }    } else {    flags |= LE_A_B_GROUPED;    }   #endif    /* FIXME: This is wrong... */    return !low_pike_types_le(b->car, a, -array_cnt, flags);    -  case T_ASSIGN: +  case T_ASSIGN: { +  struct pike_type **aa_markers = a_markers; +  struct pike_type **bb_markers = b_markers; +  int m = CAR_TO_INT(b);    ret = low_pike_types_le(a, b->cdr, array_cnt, flags); -  if(ret && (a->type != T_VOID)) +  +  if (flags & LE_A_B_SWAPPED) { +  aa_markers = b_markers; +  bb_markers = a_markers; +  } +  +  if(ret && (!bb_markers[m] || a->type != T_VOID))    {    int m = CAR_TO_INT(b);    struct pike_type *tmp;    int i;       type_stack_mark(); -  if (flags & LE_A_B_SWAPPED) { -  push_finished_type_with_markers(a, b_markers, 0); -  } else { -  push_finished_type_with_markers(a, a_markers, 0); -  } +  push_finished_type_with_markers(a, aa_markers, 0);    for(i = array_cnt; i < 0; i++)    push_type(T_ARRAY);    tmp=pop_unfinished_type();       type_stack_mark(); -  if (flags & LE_A_B_SWAPPED) { -  low_or_pike_types(a_markers[m], tmp, 0); -  if(a_markers[m]) free_type(a_markers[m]); +  low_or_pike_types(bb_markers[m], tmp, 0); +  if(bb_markers[m]) free_type(bb_markers[m]);    free_type(tmp); -  a_markers[m] = pop_unfinished_type(); -  } else { -  low_or_pike_types(b_markers[m], tmp, 0); -  if(b_markers[m]) free_type(b_markers[m]); -  free_type(tmp); -  b_markers[m] = pop_unfinished_type(); -  } +  bb_markers[m] = pop_unfinished_type();   #ifdef PIKE_TYPE_DEBUG    if (l_flag>2) {    if (flags & LE_A_B_SWAPPED) {    fprintf(stderr, "%*sa_markers[%c]=",    indent * 2, "", (char)(m+'0'));    simple_describe_type(a_markers[m]);    } else {    fprintf(stderr, "%*sb_markers[%c]=",    indent * 2, "", (char)(m+'0'));    simple_describe_type(b_markers[m]);    }    fprintf(stderr, "\n");    }   #endif    }    return ret; -  +  }    case '0': case '1': case '2': case '3': case '4':    case '5': case '6': case '7': case '8': case '9':    {    int m = b->type - '0';    if (flags & LE_A_B_SWAPPED) {    if(a_markers[m]) {    b = a_markers[m];    } else {    b = mixed_type_string;    }
pike.git/src/pike_types.c:7379:    struct pike_string *b_file,    INT32 b_line,    struct pike_type *type_b)   {    DECLARE_CYCLIC();       implements_a=0;    implements_b=0;    implements_mode=0;    -  match_types(type_a, type_b); +  /* Note the argument order. */ +  pike_types_le(type_b, type_a);      #if 0    if(!(implements_a && implements_b &&    type_a->str[0]==T_OBJECT &&    type_b->str[0]==T_OBJECT))   #endif /* 0 */    {    ref_push_type_value(type_a);    yytype_report(severity_level, NULL, 0, NULL, a_file, a_line, NULL,    1, "Expected: %O.");