Skip to content

Commit

Permalink
Improve check for encrypted variables (#12369)
Browse files Browse the repository at this point in the history
- Consider a component with an encrypted parent to also be encrypted.
  • Loading branch information
perost committed May 3, 2024
1 parent 7b27e79 commit 5789400
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion OMCompiler/Compiler/NFFrontEnd/NFVariable.mo
Expand Up @@ -321,7 +321,25 @@ public

function isEncrypted
input Variable variable;
output Boolean isEncrypted = StringUtil.endsWith(variable.info.fileName, ".moc");
output Boolean isEncrypted;
protected
ComponentRef name;
SourceInfo info;
algorithm
name := variable.name;

while ComponentRef.isCref(name) loop
info := InstNode.info(ComponentRef.node(name));

if StringUtil.endsWith(info.fileName, ".moc") then
isEncrypted := true;
return;
end if;

name := ComponentRef.rest(name);
end while;

isEncrypted := false;
end isEncrypted;

function isAccessible
Expand Down

0 comments on commit 5789400

Please sign in to comment.