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

Commit

Permalink
[NF] Make array constructors structural in bindings.
Browse files Browse the repository at this point in the history
- Mark the ranges of array constructors used in binding equations as
  structural, since bindings must have known sizes (with the exception
  of function parameters).

Belonging to [master]:
  - #2537
  - OpenModelica/OpenModelica-testsuite#984
  • Loading branch information
perost authored and OpenModelica-Hudson committed Jun 28, 2018
1 parent f761280 commit 592a4a4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Compiler/NFFrontEnd/NFBinding.mo
Expand Up @@ -166,6 +166,13 @@ public
end match;
end typedExp;

function getUntypedExp
input Binding binding;
output Expression exp;
algorithm
UNTYPED_BINDING(bindingExp = exp) := binding;
end getUntypedExp;

function getTypedExp
input Binding binding;
output Expression exp;
Expand Down
29 changes: 29 additions & 0 deletions Compiler/NFFrontEnd/NFInst.mo
Expand Up @@ -2906,6 +2906,10 @@ algorithm
markStructuralParamsDim(dim);
end for;

if Binding.isBound(c.binding) then
markStructuralParamsExpSize(Binding.getUntypedExp(c.binding));
end if;

updateImplicitVariability(c.classInst);
then
();
Expand Down Expand Up @@ -2971,6 +2975,31 @@ algorithm
end match;
end markStructuralParamsExp_traverser;

function markStructuralParamsExpSize
input Expression exp;
algorithm
Expression.apply(exp, markStructuralParamsExpSize_traverser);
end markStructuralParamsExpSize;

function markStructuralParamsExpSize_traverser
input Expression exp;
algorithm
() := match exp
local
list<tuple<InstNode, Expression>> iters;

case Expression.CALL(call = Call.UNTYPED_MAP_CALL(iters = iters))
algorithm
for iter in iters loop
markStructuralParamsExp(Util.tuple22(iter));
end for;
then
();

else ();
end match;
end markStructuralParamsExpSize_traverser;

function updateImplicitVariabilityEql
input list<Equation> eql;
input Boolean inWhen = false;
Expand Down

0 comments on commit 592a4a4

Please sign in to comment.