You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2022/03/31 14:47:55 UTC
[plc4x] 02/10: fix(codegen/plc4go): Fixed a problem using unary expressions in plc4go static calls
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit afbdbc2d0371441faae9bd96d0f09740bc88a90c
Author: cdutz <ch...@c-ware.de>
AuthorDate: Thu Mar 31 16:41:30 2022 +0200
fix(codegen/plc4go): Fixed a problem using unary expressions in plc4go static calls
---
.../org/apache/plc4x/language/go/GoLanguageTemplateHelper.java | 3 +++
.../org/apache/plc4x/java/test/readwrite/utils/StaticHelper.java | 8 ++++++++
2 files changed, 11 insertions(+)
diff --git a/code-generation/language-go/src/main/java/org/apache/plc4x/language/go/GoLanguageTemplateHelper.java b/code-generation/language-go/src/main/java/org/apache/plc4x/language/go/GoLanguageTemplateHelper.java
index 58df6ea..6dbbda4 100644
--- a/code-generation/language-go/src/main/java/org/apache/plc4x/language/go/GoLanguageTemplateHelper.java
+++ b/code-generation/language-go/src/main/java/org/apache/plc4x/language/go/GoLanguageTemplateHelper.java
@@ -939,6 +939,9 @@ public class GoLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelp
if (i > 1) {
sb.append(", ");
}
+ if (arg instanceof UnaryTerm) {
+ arg = ((UnaryTerm) arg).getA();
+ }
if (arg instanceof VariableLiteral) {
tracer = tracer.dive("VariableLiteral");
VariableLiteral va = (VariableLiteral) arg;
diff --git a/code-generation/language-java/src/test/resources/integration-test/src/main/java/org/apache/plc4x/java/test/readwrite/utils/StaticHelper.java b/code-generation/language-java/src/test/resources/integration-test/src/main/java/org/apache/plc4x/java/test/readwrite/utils/StaticHelper.java
index 4e278a2..88078d1 100644
--- a/code-generation/language-java/src/test/resources/integration-test/src/main/java/org/apache/plc4x/java/test/readwrite/utils/StaticHelper.java
+++ b/code-generation/language-java/src/test/resources/integration-test/src/main/java/org/apache/plc4x/java/test/readwrite/utils/StaticHelper.java
@@ -79,4 +79,12 @@ public class StaticHelper {
}
+ public static short crcInt8(int num) {
+ return (byte) num;
+ }
+
+ public static short crcUint8(int num) {
+ return (short) num;
+ }
+
}