> struct a b end;
> method f()
> var z := a;
> end;
ist deswegen gueltig, da a zu this.a wird, und this eine struktur sein kann.
aber auch das ist gueltig:
> struct a b end;
> method f(a)
> var z := a;
> end;
hier soll der parameter bzw. die variable 'a' den vorang haben.
- @c check_variable(@Lexpr.s@, @IDENT.name@);
+ @c check(@Lexpr.s@, @IDENT.name@, S_VAR);
- @c check_field(@Feld.s@, @IDENT.name@);
+ @c check(@Feld.s@, @IDENT.name@, S_FIELD);
- @c check_variable(@Term.s@, @IDENT.name@);
+ @c check(@Term.s@, @IDENT.name@, S_VAR);
-static void check_gen(struct symbol *tab, char *ident, short type);
-
struct symbol *new_tab(void)
{
return SYMNULL;
struct symbol *new_tab(void)
{
return SYMNULL;
-void check_variable(struct symbol *tab, char *ident)
-{
- check_gen(tab, ident, S_VAR);
-}
-
-void check_field(struct symbol *tab, char *ident)
-{
- check_gen(tab, ident, S_FIELD);
-}
-
-static void check_gen(struct symbol *tab, char *ident, short type)
+void check(struct symbol *tab, char *ident, short type)
- struct symbol *elm = tab_lookup(tab, ident, type);
#ifdef DD
printf("check_variable: tab(%08X), ident(%s), type(%i), elm(%08X)\n", tab, ident, type, elm);
#endif
#ifdef DD
printf("check_variable: tab(%08X), ident(%s), type(%i), elm(%08X)\n", tab, ident, type, elm);
#endif
+
+ if(type == S_VAR) {
+ elm = tab_lookup(tab, ident, type);
+ if(elm != SYMNULL) {
+ return;
+ }
+ }
+
+ elm = tab_lookup(tab, ident, S_FIELD);
if(elm == SYMNULL) {
fprintf(stderr, "Unbekannter Identifier: \"%s\"\n", ident);
exit(3);
if(elm == SYMNULL) {
fprintf(stderr, "Unbekannter Identifier: \"%s\"\n", ident);
exit(3);
struct symbol *tab_lookup(struct symbol *tab, char *ident, short type);
struct symbol *tab_remove_symbol(struct symbol *tab, char *ident, short type);
struct symbol *tab_merge(struct symbol *tab, struct symbol *to_add, short check);
struct symbol *tab_lookup(struct symbol *tab, char *ident, short type);
struct symbol *tab_remove_symbol(struct symbol *tab, char *ident, short type);
struct symbol *tab_merge(struct symbol *tab, struct symbol *to_add, short check);
-void check_variable(struct symbol *tab, char *ident);
-void check_field(struct symbol *tab, char *ident);
+void check(struct symbol *tab, char *ident, short type);