From: Peep P. <so...@us...> - 2004-03-16 14:22:01
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7626 Modified Files: lang.y Log Message: Small changes regarding identifier redefining. Index: lang.y =================================================================== RCS file: /cvsroot/agd/server/src/lang.y,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- lang.y 15 Mar 2004 18:48:13 -0000 1.3 +++ lang.y 16 Mar 2004 14:12:43 -0000 1.4 @@ -128,7 +128,7 @@ def_id_t *id; v = $6.data[i]; id = find_id(v->name); - if(id) { + if(id && id->base_scope >= scope_level) { redeclaration_error(id, ID_ARG); } else { define_id(v->name, ID_ARG, v->type, NULL); @@ -406,7 +406,8 @@ sprintf(buf, "warning: declaration of %s shadows function argument", $1); display_error(buf); compile_warnings++; - } else if(id->base_scope >= scope_level) { + } else if(id->type == ID_DFUN + || id->base_scope >= scope_level) { redeclaration_error(id, ID_LVAR); } } @@ -982,35 +983,29 @@ L_DO statement L_WHILE '(' expr ')' { init_array(&$$); - if($2.length) { +/* if($2.length) {*/ array_push(&$$, (void *) F_JMP); - /* Jump past F_JMP argument, expr, F_JMPF and it's argument, - plus past it. */ - array_push(&$$, (void *) ($5.arr.length + 5)); + array_push(&$$, (void *) ($5.arr.length + 3)); array_concat(&$$, &$5.arr); array_push(&$$, (void *) F_JMPF); array_push(&$$, (void *) ($2.length + 3)); array_concat(&$$, &$2); array_push(&$$, (void *) F_JMP); array_push(&$$, (void *) -($2.length + $5.arr.length + 3)); - } else { - comp_warning("empty do-body"); - } +/* }*/ } while: L_WHILE '(' expr ')' statement { init_array(&$$); - if($5.length) { +/* if($5.length) {*/ array_concat(&$$, &$3.arr); array_push(&$$, (void *) F_JMPF); array_push(&$$, (void *) ($5.length + 3)); array_concat(&$$, &$5); array_push(&$$, (void *) F_JMP); array_push(&$$, (void *) -($5.length + $3.arr.length + 3)); - } else { - comp_warning("empty while-body"); - } +/* }*/ } ; |