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.395 2008/01/03 16:29:08 grubba Exp $ + || $Id: language.yacc,v 1.396 2008/01/03 16:49:09 grubba Exp $   */      %pure_parser      %token TOK_ARROW      /*    * Basic value pushing    */   %token TOK_CONSTANT TOK_FLOAT TOK_STRING
pike.git/src/language.yacc:1127:    | /* empty */ { $$=0; }    ;      optional_identifier: TOK_IDENTIFIER    | bad_identifier { $$=0; }    | /* empty */ { $$=0; }    ;      new_arg_name: type7 optional_dot_dot_dot optional_identifier    { +  int i;    if(Pike_compiler->varargs) yyerror("Can't define more arguments after ...");       if($2)    {    push_type(T_ARRAY);    Pike_compiler->varargs=1;    }       if(!$3)    {    $3=mkstrnode(empty_pike_string);    }       if($3->u.sval.u.string->len &&    islocal($3->u.sval.u.string) >= 0)    my_yyerror("Variable %S appears twice in argument list.",    $3->u.sval.u.string);    -  add_local_name($3->u.sval.u.string, compiler_pop_type(),0); +  i = add_local_name($3->u.sval.u.string, compiler_pop_type(),0); +  if (!(lex.pragmas & ID_STRICT_TYPES)) { +  /* Only warn about unused arguments in struct types mode. */ +  Pike_compiler->compiler_frame->variable[i].flags |= LOCAL_VAR_IS_USED; +  }    free_node($3);    }    ;      func_args: '(' arguments close_paren_or_missing    {    free_node($3);    $$=$2;    }    ;
pike.git/src/language.yacc:2561:    int f;       push_compiler_frame(SCOPE_LOCAL);       /* Init: Prepend the create arguments. */    if (Pike_compiler->num_create_args < 0) {    for (e = 0; e < -Pike_compiler->num_create_args; e++) {    id = Pike_compiler->new_program->identifiers + e;    add_ref(id->type);    add_local_name(id->name, id->type, 0); +  Pike_compiler->compiler_frame->variable[e].flags |= +  LOCAL_VAR_IS_USED;    }    } else {    for (e = 0; e < Pike_compiler->num_create_args; e++) {    id = Pike_compiler->new_program->identifiers + e;    add_ref(id->type);    add_local_name(id->name, id->type, 0); -  +  Pike_compiler->compiler_frame->variable[e].flags |= +  LOCAL_VAR_IS_USED;    }    }       /* First: Deduce the type for the create() function. */    push_type(T_VOID); /* Return type. */       if ((e = nargs) < 0) {    /* Varargs */    e = nargs = -nargs;    push_finished_type(Pike_compiler->compiler_frame->variable[--e].type);