From 4f5176c2794b9418b5c539500e0aad409e43cc80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=96stlund?= Date: Thu, 15 Feb 2024 14:05:33 +0100 Subject: [PATCH] Fix FlatModel.obfuscateCref (#11991) - Make `FlatModel.obfuscateCref` recursive so the whole cref is obfuscated and not only the last part. --- OMCompiler/Compiler/NFFrontEnd/NFFlatModel.mo | 1 + .../openmodelica/interactive-API/Obfuscation3.mos | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/OMCompiler/Compiler/NFFrontEnd/NFFlatModel.mo b/OMCompiler/Compiler/NFFrontEnd/NFFlatModel.mo index 8dffeab8b0d..5c56a5f596c 100644 --- a/OMCompiler/Compiler/NFFrontEnd/NFFlatModel.mo +++ b/OMCompiler/Compiler/NFFrontEnd/NFFlatModel.mo @@ -767,6 +767,7 @@ public cref.subscripts := list(Subscript.mapShallowExp(s, function obfuscateExp(obfuscationMap = obfuscationMap)) for s in cref.subscripts); + cref.restCref := obfuscateCref(cref.restCref, obfuscationMap); then (); diff --git a/testsuite/openmodelica/interactive-API/Obfuscation3.mos b/testsuite/openmodelica/interactive-API/Obfuscation3.mos index c3991be5281..48d19d8a036 100644 --- a/testsuite/openmodelica/interactive-API/Obfuscation3.mos +++ b/testsuite/openmodelica/interactive-API/Obfuscation3.mos @@ -38,6 +38,7 @@ loadString(" model M P1.A a1; P2.A a2; + protected P2.B b1; P2.C c1; end M; @@ -51,12 +52,12 @@ instantiateModel(M); getErrorString(); // "class M // Real a1.x; // Real a2.x \"x2\"; -// Real b1.y \"y\"; -// protected Real b1.n1; -// Real c1.y \"y\"; -// protected Real c1.n2; -// Real c1.w \"w\"; -// protected Real c1.n3 \"u\"; +// protected Real n1.n2; +// protected Real n1.n3; +// protected Real n4.n5; +// protected Real n4.n6; +// protected Real n4.n7 \"w\"; +// protected Real n4.n8 \"u\"; // end M; // " // ""