This repository was archived by the owner on May 18, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -1133,6 +1133,7 @@ algorithm
11331133
11341134 case DAE . VAR (componentRef= cr,direction= DAE . OUTPUT (), binding= binding)
11351135 equation
1136+ binding = makeComplexBinding(binding, elt. ty);
11361137 oRepl = addOptBindingReplacements(cr,binding,oRepl);
11371138 oOutputs = cr :: oOutputs;
11381139 then ();
@@ -1168,6 +1169,46 @@ algorithm
11681169
11691170end getFunctionInputsOutputBody;
11701171
1172+ function makeComplexBinding
1173+ "Creates a record binding from the given type if the given binding is empty."
1174+ input output Option < DAE . Exp > binding;
1175+ input DAE . Type ty;
1176+ algorithm
1177+ binding := match (binding, ty)
1178+ local
1179+ list< DAE . Exp > expl;
1180+ list< String > strl;
1181+ DAE . Exp exp;
1182+
1183+ case (NONE (), DAE . Type . T_COMPLEX ())
1184+ algorithm
1185+ expl := {};
1186+ strl := {};
1187+
1188+ for var in listReverse(ty. varLst) loop
1189+ () := match var
1190+ case DAE . Var . TYPES_VAR (binding = DAE . Binding . EQBOUND (exp = exp))
1191+ algorithm
1192+ expl := exp :: expl;
1193+ strl := var . name :: strl;
1194+ then
1195+ ();
1196+
1197+ else
1198+ algorithm
1199+ return ;
1200+ then
1201+ ();
1202+ end match;
1203+ end for ;
1204+
1205+ then
1206+ SOME (DAE . Exp . RECORD (ClassInf . getStateName(ty. complexClassType), expl, strl, ty));
1207+
1208+ else binding;
1209+ end match;
1210+ end makeComplexBinding;
1211+
11711212protected function addOptBindingReplacements
11721213 input DAE . ComponentRef cr;
11731214 input Option < DAE . Exp > binding;
You can’t perform that action at this time.
0 commit comments