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

Commit 3c1d34e

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Collect functions in builtin attributes.
Belonging to [master]: - #2869
1 parent 0fb5b98 commit 3c1d34e

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

Compiler/NFFrontEnd/NFFlatten.mo

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,29 +1238,31 @@ end evaluateEquationsConnOp;
12381238
function collectComponentFuncs
12391239
input Variable var;
12401240
input output FunctionTree funcs;
1241-
protected
1242-
Binding binding;
1243-
ComponentRef cref;
1244-
InstNode node;
1245-
Type ty;
12461241
algorithm
12471242
() := match var
1248-
case Variable.VARIABLE(ty = ty, binding = binding)
1243+
case Variable.VARIABLE()
12491244
algorithm
1250-
// TODO: Collect functions from the component's type attributes.
1245+
funcs := collectTypeFuncs(var.ty, funcs);
1246+
funcs := collectBindingFuncs(var.binding, funcs);
12511247

1252-
funcs := collectTypeFuncs(ty, funcs);
1253-
1254-
// Collect functions used in the component's binding, if it has one.
1255-
if Binding.isExplicitlyBound(binding) then
1256-
funcs := collectExpFuncs(Binding.getTypedExp(binding), funcs);
1257-
end if;
1248+
for attr in var.typeAttributes loop
1249+
funcs := collectBindingFuncs(Util.tuple22(attr), funcs);
1250+
end for;
12581251
then
12591252
();
12601253

12611254
end match;
12621255
end collectComponentFuncs;
12631256

1257+
function collectBindingFuncs
1258+
input Binding binding;
1259+
input output FunctionTree funcs;
1260+
algorithm
1261+
if Binding.isExplicitlyBound(binding) then
1262+
funcs := collectExpFuncs(Binding.getTypedExp(binding), funcs);
1263+
end if;
1264+
end collectBindingFuncs;
1265+
12641266
function collectTypeFuncs
12651267
input Type ty;
12661268
input output FunctionTree funcs;

0 commit comments

Comments
 (0)