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

Commit 69a3ec4

Browse files
perostOpenModelica-Hudson
authored andcommitted
Fix : subscripting in Ceval.cevalSubscriptValue.
- Fix Ceval.cevalSubscriptValue, x[:, 1] is not the same as x[1]. Belonging to [master]: - #2955
1 parent 0470a5b commit 69a3ec4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Compiler/FrontEnd/Ceval.mo

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4538,10 +4538,16 @@ algorithm
45384538
then
45394539
(cache,res);
45404540

4541-
// we have a wholedim, so just pass the whole array on.
4541+
// we have a wholedim, apply the rest of the subscripts to each element of the array.
45424542
case (cache, env, (DAE.WHOLEDIM() :: subs), subval as Values.ARRAY(), impl, msg,_)
4543-
equation
4544-
(cache, res) = cevalSubscriptValue(cache, env, subs, subval, impl,msg,numIter+1);
4543+
algorithm
4544+
if listEmpty(subs) then
4545+
// If the wholedim is the last subscript we can just return the value as it is.
4546+
res := subval;
4547+
else
4548+
(cache,lst) := cevalSubscriptValueList(cache, env, subs, subval.valueLst, impl, msg, numIter+1);
4549+
res := ValuesUtil.makeArray(lst);
4550+
end if;
45454551
then
45464552
(cache, res);
45474553

0 commit comments

Comments
 (0)