DEADSOFTWARE

Добавлено вычисление размеров типа для аллокации
[dsw-obn.git] / oberon.c
index 931d948c57bc15c0faf906e0a6f23b52f991a122..dab60b0bb151dce64579a099f2aa59f5722a2eb6 100644 (file)
--- a/oberon.c
+++ b/oberon.c
@@ -2602,16 +2602,19 @@ oberon_make_new_call(oberon_context_t * ctx, int num_args, oberon_expr_t * list_
        type = type -> base;
 
        oberon_expr_t * src;
+       src = oberon_new_item(MODE_NEW, dst -> result, 0);
+       src -> item.num_args = 0;
+       src -> item.args = NULL;
+
        if(type -> class == OBERON_TYPE_ARRAY)
        {
+               // Пригодится при работе с открытыми массивами
+               /*
                int dim = 1;
-
                oberon_expr_t * sizes = NULL;
                oberon_expr_t * last_size = NULL;
-
                sizes = last_size = oberon_new_item(MODE_INTEGER, ctx -> int_type, 1);
                sizes -> item.integer = type -> size;
-
                oberon_type_t * base = type -> base;
                while(base -> class == OBERON_TYPE_ARRAY)
                {
@@ -2624,13 +2627,12 @@ oberon_make_new_call(oberon_context_t * ctx, int num_args, oberon_expr_t * list_
                        base = base -> base;
                        dim += 1;
                }
+               */
 
-               src = oberon_new_item(MODE_NEWARR, dst -> result, 0);
-               src -> item.num_args = dim;
-               src -> item.args = sizes;
-               src -> item.type = base;
+               src -> item.num_args = 0;
+               src -> item.args = NULL;
        }
-       else
+       else if(type -> class != OBERON_TYPE_RECORD)
        {
                oberon_error(ctx, "oberon_make_new_call: wat");
        }