DEADSOFTWARE

JVM: наличие VAR-парамеров отражается в имени класса процедур
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Wed, 23 Aug 2017 10:15:27 +0000 (13:15 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Wed, 23 Aug 2017 10:15:27 +0000 (13:15 +0300)
Test.obn
src/backends/jvm/generator-jvm-basic.c

index 3c862c1d5917486426e84aa32439b268bb8baf88..6fae5299c4ceb508ddf3708622d39e419e562a12 100644 (file)
--- a/Test.obn
+++ b/Test.obn
@@ -1,28 +1,3 @@
 MODULE Test;
 
-TYPE
-  Object = RECORD
-    mth : PROCEDURE;
-  END;
-
-VAR
-  p : PROCEDURE;
-  o, a : Object;
-
-PROCEDURE X;
-END X;
-
-PROCEDURE Z(VAR g : Object);
-BEGIN
-  g.mth;
-END Z;
-
-BEGIN
-  p := X;
-  ASSERT(p # NIL);
-  o.mth := X;
-  ASSERT(o.mth # NIL);
-  a := o;
-  ASSERT(a.mth # NIL);
-  Z(a);
 END Test.
index 855a61722c677d750a8bd84ea2fe27a1652e2723..61088af9bfb6a30b372fe071e85a30b4387d1dc8 100644 (file)
@@ -375,6 +375,7 @@ jvm_get_class_full_name(oberon_type_t * type)
                        name = new_string("SYSTEM$PROCEDURE");
 
                        char * desc;
+                       char * spec;
                        desc = jvm_get_descriptor_safe(type -> base);
                        name = new_string("%s$%s", name, desc);
 
@@ -383,8 +384,13 @@ jvm_get_class_full_name(oberon_type_t * type)
 
                        for(int i = 0; i < num; i++)
                        {
+                               spec = "";
+                               if(arg -> class == OBERON_CLASS_VAR_PARAM)
+                               {
+                                       spec = "VAR";
+                               }
                                desc = jvm_get_descriptor_safe(arg -> type);
-                               name = new_string("%s%s", name, desc);
+                               name = new_string("%s%s%s", name, spec, desc);
                                arg = arg -> next;
                        }