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

Commit 5ce0593

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Fix ExpandExp.expandRange.
- Use Ceval instead of RangeIterator to create the array of elements, since the range might contain expressions that need to be evaluated. Belonging to [master]: - #2631
1 parent 7d0f654 commit 5ce0593

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

Compiler/NFFrontEnd/NFCeval.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ end evalExp;
251251

252252
function evalExpOpt
253253
input output Option<Expression> oexp;
254-
input EvalTarget target;
254+
input EvalTarget target = EvalTarget.IGNORE_ERRORS();
255255
algorithm
256256
oexp := match oexp
257257
local

Compiler/NFFrontEnd/NFExpandExp.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ protected
4747
import SimplifyExp = NFSimplifyExp;
4848
import NFPrefixes.Variability;
4949
import MetaModelica.Dangerous.*;
50+
import EvalTarget = NFCeval.EvalTarget;
5051

5152
public
5253
function expand
@@ -209,8 +210,7 @@ public
209210
expanded := Type.hasKnownSize(ty);
210211

211212
if expanded then
212-
range_iter := RangeIterator.fromExp(exp);
213-
outExp := Expression.ARRAY(ty, RangeIterator.toList(range_iter));
213+
outExp := Ceval.evalExp(exp);
214214
else
215215
outExp := exp;
216216
end if;

Compiler/NFFrontEnd/NFExpression.mo

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,11 @@ protected
3939
import BuiltinCall = NFBuiltinCall;
4040
import Expression = NFExpression;
4141
import Function = NFFunction;
42-
import RangeIterator = NFRangeIterator;
4342
import NFPrefixes.Variability;
4443
import Prefixes = NFPrefixes;
4544
import Ceval = NFCeval;
4645
import ComplexType = NFComplexType;
4746
import MetaModelica.Dangerous.listReverseInPlace;
48-
import ExpandExp = NFExpandExp;
4947

5048
public
5149
import Absyn.Path;

0 commit comments

Comments
 (0)