Skip to content

Commit

Permalink
[NF] Improve Expression.splitRecordCref.
Browse files Browse the repository at this point in the history
- Improve splitRecordCref so that it can handle arrays of records too,
  to reduce the amount of complex bindings that're moved to equations.

Belonging to [master]:
  - OpenModelica/OMCompiler#2850
  • Loading branch information
perost authored and OpenModelica-Hudson committed Jan 8, 2019
1 parent cf3c2d4 commit 17e1186
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Compiler/NFFrontEnd/NFExpression.mo
Expand Up @@ -4654,7 +4654,9 @@ public
input Expression exp;
output Expression outExp;
algorithm
outExp := match exp
outExp := ExpandExp.expand(exp);

outExp := match outExp
local
InstNode cls;
array<InstNode> comps;
Expand All @@ -4673,7 +4675,13 @@ public
fields := CREF(ty, field_cr) :: fields;
end for;
then
RECORD(InstNode.scopePath(cls), exp.ty, fields);
RECORD(InstNode.scopePath(cls), outExp.ty, fields);

case ARRAY()
algorithm
outExp.elements := list(splitRecordCref(e) for e in outExp.elements);
then
outExp;

else exp;
end match;
Expand Down

0 comments on commit 17e1186

Please sign in to comment.