DEADSOFTWARE

Что-то там тестировалось с массивами...
[dsw-obn.git] / oberon.c
index 847e9c77e65a4352cadb204f4948076f8b19ba82..f4a711f5da3156912e43afb4bc8887dd076936a3 100644 (file)
--- a/oberon.c
+++ b/oberon.c
@@ -758,11 +758,11 @@ oberon_make_array_selector(oberon_context_t * ctx, oberon_expr_t * desig, int nu
                oberon_error(ctx, "not array");
        }
 
-       int dim = desig -> item.var -> type -> dim;
-       if(num_indexes != dim)
-       {
-               oberon_error(ctx, "dimesions not matched");
-       }
+//     int dim = desig -> item.var -> type -> dim;
+//     if(num_indexes != dim)
+//     {
+//             oberon_error(ctx, "dimesions not matched");
+//     }
 
        oberon_type_t * base = desig -> item.var -> type -> base;
 
@@ -1399,9 +1399,8 @@ oberon_const_decl(oberon_context_t * ctx)
 }
 
 static void
-oberon_make_array_type(oberon_context_t * ctx, int dim, oberon_item_t * size, oberon_type_t * base, oberon_type_t ** type)
+oberon_make_array_type(oberon_context_t * ctx, oberon_item_t * size, oberon_type_t * base, oberon_type_t ** type)
 {
-       assert(dim == 1);
        if(size -> mode != MODE_INTEGER)
        {
                oberon_error(ctx, "requires integer constant");
@@ -1410,7 +1409,6 @@ oberon_make_array_type(oberon_context_t * ctx, int dim, oberon_item_t * size, ob
        oberon_type_t * arr;
        arr = *type;
        arr -> class = OBERON_TYPE_ARRAY;
-       arr -> dim = dim;
        arr -> size = size -> integer;
        arr -> base = base;
 }
@@ -1482,7 +1480,7 @@ oberon_type(oberon_context_t * ctx, oberon_type_t ** type)
                base = oberon_new_type_ptr(OBERON_TYPE_VOID);
                oberon_type(ctx, &base);
 
-               oberon_make_array_type(ctx, 1, size, base, type);
+               oberon_make_array_type(ctx, size, base, type);
        }
        else if(ctx -> token == RECORD)
        {
@@ -1523,8 +1521,10 @@ oberon_type(oberon_context_t * ctx, oberon_type_t ** type)
        }
        else if(ctx -> token == PROCEDURE)
        {
+               oberon_open_scope(ctx);
                oberon_assert_token(ctx, PROCEDURE);
                oberon_opt_formal_pars(ctx, type);
+               oberon_close_scope(ctx -> decl);
        }
        else
        {
@@ -1786,8 +1786,8 @@ oberon_initialize_type(oberon_context_t * ctx, oberon_type_t * type)
        }
        else if(type -> class == OBERON_TYPE_ARRAY)
        {
-               oberon_generator_init_type(ctx, type);
                oberon_initialize_type(ctx, type -> base);              
+               oberon_generator_init_type(ctx, type);
        }
        else if(type -> class == OBERON_TYPE_RECORD)
        {