pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:1:   /* -*- c -*-   || 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: language.yacc,v 1.374 2007/05/02 17:43:32 grubba Exp $ + || $Id: language.yacc,v 1.375 2007/09/03 11:57:01 grubba Exp $   */      %pure_parser      %token TOK_ARROW      /*    * Basic value pushing    */   %token TOK_CONSTANT TOK_FLOAT TOK_STRING
pike.git/src/language.yacc:1948:    char buf[80];    int f,e;    struct pike_string *name;    struct pike_string *save_file = lex.current_file;    int save_line = lex.current_line;    lex.current_file = $2->current_file;    lex.current_line = $2->line_number;       debug_malloc_touch($7);    $7=mknode(F_COMMA_EXPR,$7,mknode(F_RETURN,mkintnode(0),0)); -  if (Pike_compiler->compiler_pass == 2) +  if (Pike_compiler->compiler_pass == 2) {    /* Doing this in pass 1 might induce too strict checks on types    * in cases where we got placeholders. */    type=find_return_type($7); -  else -  type = NULL; -  -  if(type) { +  if (type) {    push_finished_type(type);    free_type(type); -  } else +  } else { +  yywarning("Failed to determine return type for lambda."); +  push_type(T_ZERO); +  } +  } else { +  /* Tentative return type. */    push_type(T_MIXED); -  +  }       e=$5-1;    if($<number>6)    {    push_finished_type(Pike_compiler->compiler_frame->variable[e].type);    e--;    pop_type_stack(T_ARRAY);    }else{    push_type(T_VOID);    }
pike.git/src/language.yacc:1986:       type=compiler_pop_type();       sprintf(buf,"__lambda_%ld_%ld_line_%d",    (long)Pike_compiler->new_program->id,    (long)(Pike_compiler->local_class_counter++ & 0xffffffff), /* OSF/1 cc bug. */    (int) lex.current_line);    name=make_shared_string(buf);      #ifdef LAMBDA_DEBUG -  fprintf(stderr, "%d: LAMBDA: %s 0x%08lx 0x%08lx\n", -  Pike_compiler->compiler_pass, buf, (long)Pike_compiler->new_program->id, Pike_compiler->local_class_counter-1); +  fprintf(stderr, "%d: LAMBDA: %s 0x%08lx 0x%08lx\n%d: type: ", +  Pike_compiler->compiler_pass, buf, (long)Pike_compiler->new_program->id, Pike_compiler->local_class_counter-1, Pike_compiler->compiler_pass); +  simple_describe_type(type); +  fprintf(stderr, "\n");   #endif /* LAMBDA_DEBUG */    if(Pike_compiler->compiler_pass == 2)    Pike_compiler->compiler_frame->current_function_number=isidentifier(name);       f=dooptcode(name,    $7,    type,    ID_STATIC | ID_PRIVATE | ID_INLINE);      #ifdef LAMBDA_DEBUG
pike.git/src/language.yacc:3146:    int save_line = lex.current_line;    lex.current_file = $2->current_file;    lex.current_line = $2->line_number;       /* block code */    unuse_modules(Pike_compiler->num_used_modules - $<number>1);    pop_local_variables($<number>4);       debug_malloc_touch($5);    $5=mknode(F_COMMA_EXPR,$5,mknode(F_RETURN,mkintnode(0),0)); -  if (Pike_compiler->compiler_pass == 2) +  if (Pike_compiler->compiler_pass == 2) {    /* Doing this in pass 1 might induce too strict checks on types    * in cases where we got placeholders. */    type=find_return_type($5); -  else -  type = NULL; -  -  if(type) { +  if (type) {    push_finished_type(type);    free_type(type); -  } else +  } else { +  yywarning("Failed to determine return type for implicit lambda."); +  push_type(T_ZERO); +  } +  } else { +  /* Tentative return type. */    push_type(T_MIXED); -  +  }       push_type(T_VOID);    push_type(T_MANY);   /*    e=$5-1;    for(; e>=0; e--)    push_finished_type(Pike_compiler->compiler_frame->variable[e].type);   */       type=compiler_pop_type();