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

Commit 2eed74c

Browse files
vwaurichOpenModelica-Hudson
authored andcommitted
proper cref comparison in evalFunc
1 parent 3645e8b commit 2eed74c

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Compiler/BackEnd/EvaluateFunctions.mo

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,18 +1298,22 @@ algorithm
12981298
list<DAE.Exp> expLst, constExps;
12991299
list<DAE.ComponentRef> constCrefs;
13001300
case(_,{},_,_)
1301-
equation
1302-
lhsCref = Expression.expCref(lhsExpIn);
1303-
constCrefs = List.map(constScalarCrefs,ComponentReference.crefStripFirstIdent);
1304-
constCrefs = List.map1(constCrefs,ComponentReference.joinCrefsR,lhsCref);
1301+
algorithm
1302+
lhsCref := Expression.expCref(lhsExpIn);
1303+
constCrefs := List.map(constScalarCrefs,ComponentReference.crefStripFirstIdent);
1304+
constCrefs := List.map1(constCrefs,ComponentReference.joinCrefsR,lhsCref);
13051305
then
13061306
(constCrefs,{});
13071307
case({},_,_,DAE.TUPLE(PR=expLst))
1308-
equation
1309-
// tuple equation with only 1d or completely complex outputs
1310-
pos = List.map1(constComplCrefs,List.position,allOutputCrefs);
1311-
constExps = List.map1(pos,List.getIndexFirst,expLst);
1312-
constCrefs = List.map(constExps,Expression.expCref);
1308+
algorithm
1309+
// tuple equation with only 1d or completely complex outputs
1310+
pos := {};
1311+
for lhsCref in constComplCrefs loop
1312+
pos := List.position1OnTrue(allOutputCrefs, ComponentReference.crefEqual,lhsCref)::pos;
1313+
end for;
1314+
pos := listReverse(pos);
1315+
constExps := List.map1(pos,List.getIndexFirst,expLst);
1316+
constCrefs := List.map(constExps,Expression.expCref);
13131317
then
13141318
({},constCrefs);
13151319
else

0 commit comments

Comments
 (0)