Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 17e1186

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Improve Expression.splitRecordCref.
- 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]: - #2850
1 parent cf3c2d4 commit 17e1186

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Compiler/NFFrontEnd/NFExpression.mo

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4654,7 +4654,9 @@ public
46544654
input Expression exp;
46554655
output Expression outExp;
46564656
algorithm
4657-
outExp := match exp
4657+
outExp := ExpandExp.expand(exp);
4658+
4659+
outExp := match outExp
46584660
local
46594661
InstNode cls;
46604662
array<InstNode> comps;
@@ -4673,7 +4675,13 @@ public
46734675
fields := CREF(ty, field_cr) :: fields;
46744676
end for;
46754677
then
4676-
RECORD(InstNode.scopePath(cls), exp.ty, fields);
4678+
RECORD(InstNode.scopePath(cls), outExp.ty, fields);
4679+
4680+
case ARRAY()
4681+
algorithm
4682+
outExp.elements := list(splitRecordCref(e) for e in outExp.elements);
4683+
then
4684+
outExp;
46774685

46784686
else exp;
46794687
end match;

0 commit comments

Comments
 (0)