Skip to content

Commit

Permalink
[NF] Partially revert 497427d.
Browse files Browse the repository at this point in the history
- Relax the record check in Inst.instComplexType to only apply to
  models, since it currently causes issues for some connectors.
  • Loading branch information
perost committed Nov 27, 2019
1 parent e0502ef commit 2366380
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion OMCompiler/Compiler/NFFrontEnd/NFInst.mo
Expand Up @@ -2225,7 +2225,9 @@ algorithm

case Type.COMPLEX(complexTy = ComplexType.RECORD(node))
// Make sure it's really a record, and not e.g. a record inherited by a model.
guard InstNode.isRecord(node)
// TODO: This check should really be InstNode.isRecord(node), but that
// causes issues with e.g. ComplexInput/ComplexOutput.
guard not InstNode.isModel(node)
algorithm
instRecordConstructor(node);
then
Expand Down
11 changes: 11 additions & 0 deletions OMCompiler/Compiler/NFFrontEnd/NFInstNode.mo
Expand Up @@ -1611,6 +1611,17 @@ uniontype InstNode
case COMPONENT_NODE() then isRecord(Component.classInstance(Pointer.access(node.component)));
end match;
end isRecord;

function isModel
input InstNode node;
output Boolean isModel;
algorithm
isModel := match node
case CLASS_NODE() then Restriction.isModel(Class.restriction(Pointer.access(node.cls)));
case COMPONENT_NODE() then isModel(Component.classInstance(Pointer.access(node.component)));
else false;
end match;
end isModel;
end InstNode;

annotation(__OpenModelica_Interface="frontend");
Expand Down
10 changes: 10 additions & 0 deletions OMCompiler/Compiler/NFFrontEnd/NFRestriction.mo
Expand Up @@ -196,6 +196,16 @@ public
end match;
end isClock;

function isModel
input Restriction res;
output Boolean isModel;
algorithm
isModel := match res
case MODEL() then true;
else false;
end match;
end isModel;

function toString
input Restriction res;
output String str;
Expand Down

0 comments on commit 2366380

Please sign in to comment.