pike.git / src / las.c

version» Context lines:

pike.git/src/las.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.   \*/   /**/   #include "global.h" - RCSID("$Id: las.c,v 1.293 2002/06/06 16:26:00 mast Exp $"); + RCSID("$Id: las.c,v 1.294 2002/06/07 17:45:49 nilsson 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:3394:    if (CAR(n) && CAR(n)->type) {    if (!check_soft_cast(old_type, CAR(n)->type)) {    struct pike_string *t1 = describe_type(old_type);    struct pike_string *t2 = describe_type(CAR(n)->type);    yywarning("Soft cast to %s isn't a restriction of %s.",    t1->str, t2->str);    free_string(t2);    free_string(t1);    }    /* FIXME: check_soft_cast() is weaker than pike_types_le() -  * The resulting type should probably be the and between the old +  * The resulting type should probably be the AND between the old    * and the new type.    */    }    /* FALL_THROUGH */    case F_CAST:    /* Type-field is correct by definition. */    copy_pike_type(n->type, old_type);    break;       case F_LAND:
pike.git/src/las.c:3435:    if (!CAR(n) || (CAR(n)->type == void_type_string)) {    my_yyerror("Assigning a void expression.");    copy_pike_type(n->type, void_type_string);    break;    } else if(CAR(n) && CDR(n)) {    /* Ensure that the type-fields are up to date. */    fix_type_field(CAR(n));    fix_type_field(CDR(n));    if (!pike_types_le(CAR(n)->type, CDR(n)->type)) {    /* a["b"]=c and a->b=c can be valid when a is an array */ -  if (CDR(n)->token != F_INDEX && -  CDR(n)->token != F_ARROW && +  if (((CDR(n)->token != F_INDEX && +  CDR(n)->token != F_ARROW) || +  !match_types(array_type_string, CDR(n)->type)) &&    !match_types(CDR(n)->type,CAR(n)->type)) {    yytype_error("Bad type in assignment.",    CDR(n)->type, CAR(n)->type, 0);    } else if (lex.pragmas & ID_STRICT_TYPES) {    struct pike_string *t1 = describe_type(CAR(n)->type);    struct pike_string *t2 = describe_type(CDR(n)->type);   #ifdef PIKE_DEBUG    if (l_flag > 0) {    fprintf(stderr, "Warning: Invalid assignment: ");    print_tree(n);