codea: refactor, teil1
[uebersetzerbau-ss10.git] / codea / symtable.c
index b38500040d542ab5fce25f7226da6b2ce2009237..47762405fad1f69f1da306b6ec9a37da155452f7 100755 (executable)
@@ -40,7 +40,7 @@ struct symbol *tab_add_symbol(struct symbol *tab, char *ident, short type, short
                exit(4);
        }
 
-       if(tab_lookup(tab, ident, type) != SYMNULL) {
+       if(tab_lookup(tab, ident, type) != SYMNULL || (type == S_VAR && tab_lookup(tab, ident, S_PARM) != SYMNULL)) {
                if(check) {
                        fprintf(stderr, "Identifier doppelt vorhanden: \"%s\"\n", ident);
                        exit(3);
@@ -56,9 +56,7 @@ struct symbol *tab_add_symbol(struct symbol *tab, char *ident, short type, short
        new_elm->param_index = param_index;
        new_elm->soffset = soffset;
 
-       if(tab == SYMNULL) {
-               return new_elm;
-       }
+       if(tab == SYMNULL) return new_elm;
 
        while(elm->next != SYMNULL) {
                elm = elm->next;
@@ -72,9 +70,7 @@ struct symbol *tab_lookup(struct symbol *tab, char *ident, short type)
 {
        struct symbol *elm = tab;
 
-       if(tab == SYMNULL) {
-               return SYMNULL;
-       }
+       if(tab == SYMNULL) return SYMNULL;
 
        do {
                if((elm->type & type) && (strcmp(elm->ident, ident) == 0)) {