From: DeaDDooMER <deaddoomer@deadsoftware.ru>
Date: Wed, 27 Sep 2017 18:03:22 +0000 (+0300)
Subject: JVM: исправлен конфлик имён локальных и глобальных процедур
X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=ac2eb0e30e5c65480e72565b104ea9a602fe31e2;p=dsw-obn.git

JVM: исправлен конфлик имён локальных и глобальных процедур
---

diff --git a/Test.obn b/Test.obn
index da60894..22a2a55 100644
--- a/Test.obn
+++ b/Test.obn
@@ -1,10 +1,14 @@
 MODULE Test;
 
-PROCEDURE A;
+PROCEDURE A(a : INTEGER);
+  VAR
+    x : INTEGER;
 END A;
 
-PROCEDURE B;
-  PROCEDURE A;
+PROCEDURE B(b : SHORTINT);
+  PROCEDURE A(c : LONGINT);
+    VAR
+      y : ARRAY 3 OF INTEGER;
   END A;
 END B;
 
diff --git a/src/backends/jvm/generator-jvm-basic.c b/src/backends/jvm/generator-jvm-basic.c
index 033b842..2088559 100644
--- a/src/backends/jvm/generator-jvm-basic.c
+++ b/src/backends/jvm/generator-jvm-basic.c
@@ -330,13 +330,17 @@ jvm_get_field_full_name(oberon_object_t * x)
 	{
 		case OBERON_CLASS_VAR:
 			return new_string("%s/%s", x -> module -> name, jvm_get_name(x));
+			break;
 		case OBERON_CLASS_PROC:
 			return new_string("%s/%s", x -> module -> name, jvm_get_name(x));
+			break;
 		case OBERON_CLASS_FIELD:
 			parent = jvm_get_class_full_name(x -> parent_type);
 			return new_string("%s/%s", parent, jvm_get_name(x));
+			break;
 		case OBERON_CLASS_MODULE:
 			return new_string(x -> module -> name);
+			break;
 		default:
 			gen_error("jvm_get_field_full_name: wat");
 			break;
@@ -351,13 +355,18 @@ jvm_get_field_full_name_safe(oberon_object_t * x)
 	switch(x -> class)
 	{
 		case OBERON_CLASS_VAR:
-		case OBERON_CLASS_PROC:
 			return new_string("%s$%s", x -> module -> name, x -> name);
+			break;
+		case OBERON_CLASS_PROC:
+			return new_string("%s$%s", x -> module -> name, jvm_get_name(x));
+			break;
 		case OBERON_CLASS_FIELD:;
 			char * rec_name = jvm_get_class_full_name(x -> parent_type);
 			return new_string("%s$%s", rec_name, x -> name);
+			break;
 		case OBERON_CLASS_MODULE:
 			return new_string(x -> module -> name);
+			break;
 		default:
 			gen_error("jvm_get_field_full_name: wat");
 			break;
diff --git a/tests/Test29.obn b/tests/Test29.obn
index ab7e493..1df5da2 100644
--- a/tests/Test29.obn
+++ b/tests/Test29.obn
@@ -1,10 +1,14 @@
 MODULE Test29;
 
-PROCEDURE A;
+PROCEDURE A(a : INTEGER);
+  VAR
+    x : INTEGER;
 END A;
 
-PROCEDURE B;
-  PROCEDURE A;
+PROCEDURE B(b : SHORTINT);
+  PROCEDURE A(c : LONGINT);
+    VAR
+      y : ARRAY 3 OF INTEGER;
   END A;
 END B;