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.398 2008/01/03 23:01:33 grubba Exp $ + || $Id: language.yacc,v 1.399 2008/01/04 10:25:22 grubba Exp $   */      %pure_parser      %token TOK_ARROW      /*    * Basic value pushing    */   %token TOK_CONSTANT TOK_FLOAT TOK_STRING
pike.git/src/language.yacc:1147:    {    $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);       i = add_local_name($3->u.sval.u.string, compiler_pop_type(),0); -  if (!$3->u.sval.u.string->len || -  !(lex.pragmas & ID_STRICT_TYPES)) { +  if (i >= 0 && +  (!$3->u.sval.u.string->len || +  !(lex.pragmas & ID_STRICT_TYPES))) {    /* Only warn about unused arguments in strict 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);
pike.git/src/language.yacc:1759:    | optional_stars bad_identifier { $$=0; }    | optional_stars TOK_IDENTIFIER '=' expr0    {    int id;    push_finished_type($<n>0->u.sval.u.type);    if ($1 && (Pike_compiler->compiler_pass == 2) && !TEST_COMPAT (0, 6)) {    yywarning("The *-syntax in types is obsolete. Use array instead.");    }    while($1--) push_type(T_ARRAY);    id = add_local_name($2->u.sval.u.string, compiler_pop_type(),0); +  if (id >= 0) {    if (!(lex.pragmas & ID_STRICT_TYPES)) {    /* Only warn about unused initialized variables in strict types mode. */    Pike_compiler->compiler_frame->variable[id].flags |= LOCAL_VAR_IS_USED;    } -  if (id >= 0) +     $$=mknode(F_ASSIGN,$4,mklocalnode(id,0)); -  else +  } else    $$ = 0;    free_node($2);    }    | optional_stars bad_identifier '=' expr0    {    free_node($4);    $$=0;    }    | optional_stars TOK_IDENTIFIER '=' error    {
pike.git/src/language.yacc:1807:    } else    $$ = 0;    free_node($1);    }    | bad_identifier { $$=0; }    | TOK_IDENTIFIER '=' safe_expr0    {    int id;    add_ref($<n>0->u.sval.u.type);    id = add_local_name($1->u.sval.u.string, $<n>0->u.sval.u.type, 0); -  if (id >= 0) +  if (id >= 0) { +  if (!(lex.pragmas & ID_STRICT_TYPES)) { +  /* Only warn about unused initialized variables in strict types mode. */ +  Pike_compiler->compiler_frame->variable[id].flags |= LOCAL_VAR_IS_USED; +  }    $$=mknode(F_ASSIGN,$3, mklocalnode(id,0)); -  else +  } else    $$ = 0;    free_node($1);    }    | bad_identifier '=' safe_expr0 { $$=$3; }    ;      line_number_info: /* empty */    {    /* Used to hold line-number info */    $$ = mkintnode(0);
pike.git/src/language.yacc:2571:    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); +  /* Note: add_local_name() above will return e. */    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); -  +  /* Note: add_local_name() above will return e. */    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 */