DEADSOFTWARE

JVM: Реализованы локальные процедуры (без доступа к локальным переменным уровнем...
[dsw-obn.git] / src / oberon.c
index 58eb67c3eb72562294074f972fde2e15f68b5fec..66a3c7025056b195a204386c126024933c4ebca3 100644 (file)
@@ -2469,13 +2469,20 @@ oberon_proc_decl(oberon_context_t * ctx)
        signature = oberon_new_type_ptr(OBERON_TYPE_VOID);
        oberon_opt_formal_pars(ctx, &signature);        
 
-       oberon_initialize_decl(ctx);
+       //oberon_initialize_decl(ctx);
        oberon_generator_init_type(ctx, signature);
        oberon_close_scope(ctx -> decl);
 
        oberon_object_t * proc;
        proc = oberon_find_object(ctx -> decl, name, 0);
-       if(proc != NULL)
+       if(proc == NULL)
+       {
+               proc = oberon_define_object(ctx -> decl, name, OBERON_CLASS_PROC, export, read_only, false);
+               proc -> type = signature;
+               proc -> scope = proc_scope;
+               oberon_generator_init_proc(ctx, proc);
+       }
+       else
        {
                if(proc -> class != OBERON_CLASS_PROC)
                {
@@ -2497,16 +2504,15 @@ oberon_proc_decl(oberon_context_t * ctx)
 
                oberon_compare_signatures(ctx, proc -> type, signature);
        }
-       else
+
+       proc_scope -> parent = proc;
+       oberon_object_t * param = proc_scope -> list -> next;
+       while(param)
        {
-               proc = oberon_define_object(ctx -> decl, name, OBERON_CLASS_PROC, export, read_only, false);
-               proc -> type = signature;
-               proc -> scope = proc_scope;
-               oberon_generator_init_proc(ctx, proc);
+               param -> parent = proc;
+               param = param -> next;
        }
 
-       proc -> scope -> parent = proc;
-
        if(forward == 0)
        {
                proc -> linked = 1;