DEADSOFTWARE

Исправен конфликт имён локальных и глобальных процедур
[dsw-obn.git] / src / oberon.c
index cd7e97a18f3cb5531e77bd28d1253a62cdc92b85..82566471b9a11b929d832f2d51ef355aa4d23dfc 100644 (file)
@@ -305,6 +305,21 @@ oberon_find_object(oberon_scope_t * scope, char * name, bool check_it)
        return result;
 }
 
+static oberon_object_t *
+oberon_find_object_in_scope(oberon_scope_t * scope, char * name, bool check_it)
+{
+       oberon_object_t * result = NULL;
+
+       result = oberon_find_object_in_list(scope -> list, name);
+
+       if(check_it && result == NULL)
+       {
+               oberon_error(scope -> ctx, "undefined ident %s", name);
+       }
+
+       return result;
+}
+
 static oberon_object_t *
 oberon_create_object(oberon_scope_t * scope, char * name, int class, bool export, bool read_only)
 {
@@ -2469,7 +2484,7 @@ oberon_proc_decl(oberon_context_t * ctx)
        oberon_close_scope(ctx -> decl);
 
        oberon_object_t * proc;
-       proc = oberon_find_object(ctx -> decl, name, 0);
+       proc = oberon_find_object_in_scope(ctx -> decl, name, 0);
        if(proc == NULL)
        {
                proc = oberon_define_object(ctx -> decl, name, OBERON_CLASS_PROC, export, read_only, false);