Skip to content

Commit

Permalink
[NF] Fix ConnectEquations.associatedFlowCref.
Browse files Browse the repository at this point in the history
- Handle arrays of connectors in associatedFlowCref too.

Belonging to [master]:
  - OpenModelica/OMCompiler#2643
  • Loading branch information
perost authored and OpenModelica-Hudson committed Sep 11, 2018
1 parent 2fa8c5e commit df1914c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Compiler/NFFrontEnd/NFConnectEquations.mo
Expand Up @@ -787,19 +787,20 @@ function associatedFlowCref
stream cref."
input ComponentRef streamCref;
output ComponentRef flowCref;
protected
Type ty;
ComponentRef rest_cr;
InstNode flow_node;
algorithm
flowCref := match streamCref
local
InstNode flow_node;
ComponentRef.CREF(ty = ty, restCref = rest_cr) := streamCref;

flowCref := match Type.arrayElementType(ty)
// A connector with a single flow, append the flow node to the cref and return it.
case ComponentRef.CREF(ty = Type.COMPLEX(complexTy = ComplexType.CONNECTOR(flows = {flow_node})))
case Type.COMPLEX(complexTy = ComplexType.CONNECTOR(flows = {flow_node}))
then ComponentRef.prefixCref(flow_node, InstNode.getType(flow_node), {}, streamCref);

// Otherwise, remove the first part of the cref and try again.
case ComponentRef.CREF()
then associatedFlowCref(streamCref.restCref);

else associatedFlowCref(rest_cr);
end match;
end associatedFlowCref;

Expand Down

0 comments on commit df1914c

Please sign in to comment.