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.247 2001/03/20 00:25:02 grubba Exp $"); + RCSID("$Id: las.c,v 1.248 2001/03/28 17:59:36 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:920:    }    } else {    res->node_info |= opt_flags;    }    res->node_info |= OPT_APPLY;    if(b) res->tree_info |= b->tree_info;    }    break;       case F_POP_VALUE: -  copy_shared_string(res->type, void_type_string); +  copy_type(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;
pike.git/src/las.c:1054:    verify_shared_strings_tables();   #endif       return res;   }      node *debug_mkstrnode(struct pike_string *str)   {    node *res = mkemptynode();    res->token = F_CONSTANT; -  copy_shared_string(res->type, string_type_string); +  copy_type(res->type, string_type_string);    res->node_info = 0;    res->u.sval.type = T_STRING;   #ifdef __CHECKER__    res->u.sval.subtype = 0;   #endif    copy_shared_string(res->u.sval.u.string, str);       return freeze_node(res);   }   
pike.git/src/las.c:1100:    /* res->hash = hash_node(res); */   #endif /* SHARED_NODES */       return res;   }      node *debug_mkfloatnode(FLOAT_TYPE foo)   {    node *res = mkemptynode();    res->token = F_CONSTANT; -  copy_shared_string(res->type, float_type_string); +  copy_type(res->type, float_type_string);    res->u.sval.type = T_FLOAT;   #ifdef __CHECKER__    res->u.sval.subtype = 0;   #endif    res->u.sval.u.float_number = foo;       return freeze_node(res);   }      
pike.git/src/las.c:1158:      node *debug_mklocalnode(int var, int depth)   {    struct compiler_frame *f;    int e;    node *res = mkemptynode();    res->token = F_LOCAL;       f=Pike_compiler->compiler_frame;    for(e=0;e<depth;e++) f=f->previous; -  copy_shared_string(res->type, f->variable[var].type); +  copy_type(res->type, f->variable[var].type);       res->node_info = OPT_NOT_CONST | OPT_NOT_SHARED;    res->tree_info = res->node_info;   #ifdef __CHECKER__    _CDR(res) = 0;   #endif    res->u.integer.a = var;    res->u.integer.b = depth;      #ifdef SHARED_NODES
pike.git/src/las.c:1221:       check_tree(res,0);    return res;   #endif   }      node *debug_mktrampolinenode(int i)   {    node *res = mkemptynode();    res->token = F_TRAMPOLINE; -  copy_shared_string(res->type, ID_FROM_INT(Pike_compiler->new_program, i)->type); +  copy_type(res->type, ID_FROM_INT(Pike_compiler->new_program, i)->type);       /* FIXME */    if(IDENTIFIER_IS_CONSTANT(ID_FROM_INT(Pike_compiler->new_program, i)->identifier_flags))    {    res->node_info = OPT_EXTERNAL_DEPEND;    }else{    res->node_info = OPT_NOT_CONST;    }    res->tree_info=res->node_info;   
pike.git/src/las.c:1261:       id = ID_FROM_INT(parent_prog, i);   #ifdef PIKE_DEBUG    if(d_flag)    {    check_type_string(id->type);    check_string(id->name);    }   #endif    -  copy_shared_string(res->type, id->type); +  copy_type(res->type, id->type);       /* FIXME */    if(IDENTIFIER_IS_CONSTANT(id->identifier_flags))    {    res->node_info = OPT_EXTERNAL_DEPEND;    }else{    res->node_info = OPT_NOT_CONST;    }    res->tree_info = res->node_info;   
pike.git/src/las.c:3227:    if(!Pike_compiler->catch_level)    my_yyerror("Indexing on illegal type.");    n->type=index_type(type_a, type_b,n);    }    break;       case F_APPLY:    if (!CAR(n) || (CAR(n)->type == void_type_string)) {    my_yyerror("Calling a void expression.");    } else { -  struct pike_type *s; -  struct pike_type *f; +  struct pike_type *f; /* Expected type. */ +  struct pike_type *s; /* Actual type */    char *name;    INT32 max_args,args;    -  + #if defined(USE_PIKE_TYPE) && defined(NEW_ARG_CHECK) +  +  args = 0; +  +  copy_type(f, CAR(n)->type); +  +  f = new_check_call(CAR(n), &args, f, CDR(n)); +  +  if (f && (n->type = get_ret_type(f))) { +  /* Type/argument-check OK. */ +  free_type(f); +  break; +  } +  + #else /* !(USE_PIKE_TYPE && NEW_ARG_CHECK) */ +     push_type(T_MIXED); /* match any return type */    push_type(T_VOID); /* even void */    push_type(T_OR);       push_type(T_VOID); /* not varargs */    push_type(T_MANY);    function_type_max=0;    low_build_function_type(CDR(n));   #ifndef USE_PIKE_TYPE    push_type(T_FUNCTION);
pike.git/src/las.c:3369:    }else{    my_yyerror("Bad argument %d to %s.",    max_correct_args+1, name);    }       yytype_error(NULL, f, s, 0);       /* print_tree(n); */       free_type(s); + #endif /* USE_PIKE_TYPE && NEW_ARG_CHECK */    }    copy_type(n->type, mixed_type_string);    break;       case '?':    if (!CAR(n) || (CAR(n)->type == void_type_string)) {    yyerror("Conditional expression is void.");    } else if(!match_types(CAR(n)->type, mixed_type_string))    yyerror("Bad conditional expression.");