@@ -110,7 +110,7 @@ protected
110110 Option < DAE . VariableAttributes > var_attr;
111111 Option < DAE . Exp > binding_exp;
112112algorithm
113- binding_exp := convertBinding (var . binding);
113+ binding_exp := Binding . toDAEExp (var . binding);
114114 var_attr := convertVarAttributes(var . typeAttributes, var . ty, var . attributes);
115115 daeVar := makeDAEVar(var . name, var . ty, binding_exp, var . attributes,
116116 var . visibility, var_attr, var . comment, useLocalDir, false , var . info);
@@ -190,17 +190,6 @@ algorithm
190190 end match;
191191end getComponentDirection;
192192
193- function convertBinding
194- input Binding binding;
195- output Option < DAE . Exp > bindingExp;
196- algorithm
197- bindingExp := match binding
198- case Binding . UNBOUND () then NONE ();
199- case Binding . TYPED_BINDING () then SOME (Expression . toDAE(binding. bindingExp));
200- case Binding . FLAT_BINDING () then SOME (Expression . toDAE(binding. bindingExp));
201- end match;
202- end convertBinding;
203-
204193function convertVarAttributes
205194 input list< tuple< String , Binding >> attrs;
206195 input Type ty;
@@ -981,7 +970,7 @@ algorithm
981970 case Component . TYPED_COMPONENT (ty = ty, info = info)
982971 algorithm
983972 cref := ComponentRef . fromNode(node, ty);
984- binding := convertBinding (comp. binding);
973+ binding := Binding . toDAEExp (comp. binding);
985974 cls := InstNode . getClass(comp. classInst);
986975 ty_attr := list((Modifier . name(m), Modifier . binding(m)) for m in Class . getTypeAttributes(cls));
987976 attr := comp. attributes;
@@ -1061,44 +1050,38 @@ algorithm
10611050end convertExternalDeclOutput;
10621051
10631052public
1064- function makeTypesVars
1053+ function makeTypeVars
10651054 input InstNode complexCls;
10661055 output list< DAE . Var > typeVars;
10671056protected
10681057 Component comp;
10691058 DAE . Var type_var;
10701059algorithm
1071- typeVars := {};
1072-
1073- () := match cls as InstNode . getClass(complexCls)
1074- case Class . INSTANCED_CLASS (elements = ClassTree . FLAT_TREE ()) algorithm
1075-
1076- for c in ClassTree . getComponents(cls. elements) loop
1077- if InstNode . isOnlyOuter(c) or InstNode . isEmpty(c) then
1078- continue ;
1079- end if ;
1080- comp := InstNode . component(InstNode . resolveOuter(c));
1081-
1082- type_var := DAE . TYPES_VAR (InstNode . name(c)
1083- , Component . Attributes . toDAE(Component . getAttributes(comp))
1084- , Type . toDAE(Component . getType(comp))
1085- // Fix recursive bindings and update this
1086- // , Binding.toDAE(Component.getBinding(comp))
1087- , DAE . UNBOUND ()
1088- , NONE ()
1089- );
1090- typeVars := type_var::typeVars;
1091- end for ;
1092-
1093- typeVars := listReverse(typeVars);
1094- then ();
1095-
1096- else ();
1060+ typeVars := match cls as InstNode . getClass(complexCls)
1061+ case Class . INSTANCED_CLASS (elements = ClassTree . FLAT_TREE ())
1062+ then list(makeTypeVar(c) for c guard not (InstNode . isOnlyOuter(c) or InstNode . isEmpty(c))
1063+ in ClassTree . getComponents(cls. elements));
10971064
1065+ else {};
10981066 end match;
1067+ end makeTypeVars;
10991068
1100- end makeTypesVars;
1101-
1069+ function makeTypeVar
1070+ input InstNode component;
1071+ output DAE . Var typeVar;
1072+ protected
1073+ Component comp;
1074+ algorithm
1075+ comp := InstNode . component(InstNode . resolveOuter(component));
1076+
1077+ typeVar := DAE . TYPES_VAR (
1078+ InstNode . name(component),
1079+ Component . Attributes . toDAE(Component . getAttributes(comp)),
1080+ Type . toDAE(Component . getType(comp)),
1081+ Binding . toDAE(Component . getBinding(comp)),
1082+ NONE ()
1083+ );
1084+ end makeTypeVar;
11021085
11031086annotation(__OpenModelica_Interface= "frontend" );
11041087end NFConvertDAE ;
0 commit comments