summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9cc08ba)
raw | patch | inline | side by side (parent: 9cc08ba)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Mon, 28 Aug 2017 12:12:32 +0000 (15:12 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Mon, 28 Aug 2017 12:12:32 +0000 (15:12 +0300) |
Test.obn | patch | blob | history | |
src/backends/jvm/generator-jvm.c | patch | blob | history |
diff --git a/Test.obn b/Test.obn
index 6fae5299c4ceb508ddf3708622d39e419e562a12..a704f0db4d56d3206461fc18065a9afa32220c0e 100644 (file)
--- a/Test.obn
+++ b/Test.obn
MODULE Test;
+ TYPE
+ CPinfo = RECORD
+ tag : INTEGER;
+ index : ARRAY 2 OF LONGINT;
+ int : LONGINT;
+ float : REAL;
+ long : HUGEINT;
+ double : LONGREAL;
+ utf8 : POINTER TO ARRAY OF CHAR;
+ END;
+
+ CPool = POINTER TO ARRAY OF CPinfo;
+
+ VAR
+ i : HUGEINT;
+ cpool : CPool;
+
+BEGIN
+ i := 16;
+ NEW(cpool, i);
END Test.
index 4f49cfb86ca94df0b220be27f0d5fad68ac99a3b..79da2b9f68fac681b5624a512508c7228702eeb1 100644 (file)
@@ -103,6 +103,14 @@ jvm_generate_hard_cast_type(gen_proc_t * p, oberon_type_t * from, oberon_type_t
}
}
+static void
+check_index(gen_proc_t * p, oberon_type_t * index_type)
+{
+ // TODO проверка валидности границ
+ char prefix = jvm_get_prefix(index_type);
+ jvm_generate_cast_prefix(p, prefix, 'i');
+}
+
/*
* Генерирует код для инициализации массива со статическим базовым типом
* ( aref -- )
@@ -1146,14 +1154,6 @@ oberon_generate_branch(oberon_context_t * ctx, oberon_expr_t * cond, bool gotoif
}
}
-static void
-check_index(gen_proc_t * p, oberon_type_t * index_type)
-{
- // TODO проверка валидности границ
- char prefix = jvm_get_prefix(index_type);
- jvm_generate_cast_prefix(p, prefix, 'i');
-}
-
static void
push_varptr(gen_proc_t * p, oberon_expr_t * expr)
{
@@ -1286,6 +1286,7 @@ jvm_generate_expr_new_pointer(gen_proc_t * p, oberon_type_t * type, int num, obe
for(int i = 0; i < num; i++)
{
push_expr(p, arg);
+ check_index(p, arg -> result);
arg = arg -> next;
}