DEADSOFTWARE

Запрещён возврат массива или записи функцией
[dsw-obn.git] / src / oberon.c
index 1f33a03c9d82bc084e3ffb1b38777b6750bc9c2f..59a5c3d5fa7f6f11dc9e65e6b1974f59fca12770 100644 (file)
@@ -2444,6 +2444,11 @@ oberon_formal_pars(oberon_context_t * ctx, oberon_type_t * signature)
                {
                        oberon_error(ctx, "function result is not type");
                }
+               if(typeobj -> type -> class == OBERON_TYPE_RECORD
+                       || typeobj -> type -> class == OBERON_TYPE_ARRAY)
+               {
+                       oberon_error(ctx, "records or arrays could not be result of function");
+               }
                signature -> base = typeobj -> type;
        }
 }
@@ -3644,11 +3649,11 @@ oberon_statement(oberon_context_t * ctx)
                index = oberon_ident_item(ctx, iname);
                oberon_assert_token(ctx, ASSIGN);
                from = oberon_expr(ctx);
-               oberon_assign(ctx, from, index);
                oberon_assert_token(ctx, TO);
                bound = oberon_make_temp_var_item(ctx, index -> result);
                to = oberon_expr(ctx);
-               oberon_assign(ctx, to, bound);
+               oberon_assign(ctx, to, bound); // сначала temp
+               oberon_assign(ctx, from, index); // потом i
                if(ctx -> token == BY)
                {
                        oberon_assert_token(ctx, BY);