summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9a82efe)
raw | patch | inline | side by side (parent: 9a82efe)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 28 Jul 2017 13:31:04 +0000 (16:31 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 28 Jul 2017 13:31:04 +0000 (16:31 +0300) |
src/backends/jvm/generator-jvm.c | patch | blob | history | |
src/test.c | patch | blob | history |
index af45a637eaca1fbbf4655e659cd3ec68f9eaaf18..9408eca32328248fd37b8454c30b99d663ad7ebd 100644 (file)
jvm_alloc_register_untyped(p -> rf, false);
jvm_generate(p, 0, 1, "aload_0");
jvm_generate(p, 1, 0, "invokespecial java/lang/Object/<init>()V");
+
+ /* Инициализация переменных объявленных в модуле */
+ oberon_object_t * x = ctx -> mod -> decl -> list -> next;
+ while(x != NULL)
+ {
+ if(x -> class == OBERON_CLASS_VAR)
+ {
+ if(x -> type -> class == OBERON_TYPE_ARRAY
+ || x -> type -> class == OBERON_TYPE_RECORD)
+ {
+ jvm_generate_new_static(p, x -> type);
+ jvm_generate_store(p, x -> type, x -> gen_var);
+ }
+ }
+ x = x -> next;
+ }
}
void
diff --git a/src/test.c b/src/test.c
index 2419c3b7c0045ea6906c517822afe5560bff59bc..92223cdc7b49b4643f79f9edad013f341b9db6a4 100644 (file)
--- a/src/test.c
+++ b/src/test.c
static char source_test[] =
"(* Main module *)"
"MODULE Test;"
- "TYPE"
- " Packed = ARRAY 16, 32 OF RECORD a : INTEGER; r : RECORD x : INTEGER; END; END;"
- " IArray = ARRAY 16, 32, 666 OF INTEGER;"
"VAR"
- " k : POINTER TO Packed;"
- " ii : POINTER TO IArray;"
+ " g : ARRAY 4 OF INTEGER;"
+ " r : RECORD x : INTEGER; END;"
"BEGIN"
- " NEW(k);"
- " k[1, 2].a := 666;"
- " k[5, 2].r.x := 456;"
- " NEW(ii);"
+ " g[3] := 4;"
+ " r.x := 4546;"
"END Test."
;