Skip to content

Commit

Permalink
[NF] Minor fixes.
Browse files Browse the repository at this point in the history
- Remove superfluous calls to evalExpPartial in
  Ceval.evalArrayConstructor and Ceval.evalReduction.
- Fix makeExpArray so it doesn't create nested array types.
  • Loading branch information
perost committed Nov 20, 2019
1 parent 1891606 commit c7013c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions OMCompiler/Compiler/NFFrontEnd/NFCeval.mo
Expand Up @@ -3078,8 +3078,7 @@ protected
list<Type> types = {};
Type ty;
algorithm
e := evalExpPartial(exp);
(e, ranges, iters) := createIterationRanges(e, iterators);
(e, ranges, iters) := createIterationRanges(exp, iterators);

// Precompute all the types we're going to need for the arrays created.
ty := Expression.typeOf(e);
Expand Down Expand Up @@ -3174,8 +3173,7 @@ protected
list<Mutable<Expression>> iters;
ReductionFn red_fn;
algorithm
e := evalExpPartial(exp);
(e, ranges, iters) := createIterationRanges(e, iterators);
(e, ranges, iters) := createIterationRanges(exp, iterators);

(red_fn, default_exp) := match AbsynUtil.pathString(Function.name(fn))
case "sum" then (evalBinaryAdd, Expression.makeZero(ty));
Expand Down
2 changes: 1 addition & 1 deletion OMCompiler/Compiler/NFFrontEnd/NFExpression.mo
Expand Up @@ -1045,7 +1045,7 @@ public
Type ty;
algorithm
ty := typeOf(listHead(elements));
ty := Type.ARRAY(ty, {Dimension.fromInteger(listLength(elements))});
ty := Type.liftArrayLeft(ty, Dimension.fromInteger(listLength(elements)));
exp := makeArray(ty, elements, isLiteral);
end makeExpArray;

Expand Down

0 comments on commit c7013c1

Please sign in to comment.