Skip to content

Commit

Permalink
Expand support for variable children.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost committed Dec 8, 2020
1 parent 11cb38e commit df5af65
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions OMCompiler/Compiler/NFFrontEnd/NFEvalConstants.mo
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ algorithm
end if;

var.typeAttributes := list(evaluateTypeAttribute(a) for a in var.typeAttributes);
var.children := list(evaluateVariable(v) for v in var.children);
end evaluateVariable;

function evaluateBinding
Expand Down
4 changes: 4 additions & 0 deletions OMCompiler/Compiler/NFFrontEnd/NFFlatten.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1634,6 +1634,10 @@ algorithm
for attr in var.typeAttributes loop
funcs := collectBindingFuncs(Util.tuple22(attr), funcs);
end for;

for c in var.children loop
funcs := collectComponentFuncs(c, funcs);
end for;
then
();

Expand Down
1 change: 1 addition & 0 deletions OMCompiler/Compiler/NFFrontEnd/NFSimplifyModel.mo
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function simplifyVariable
algorithm
var.binding := simplifyBinding(var.binding);
var.typeAttributes := list(simplifyTypeAttribute(a) for a in var.typeAttributes);
var.children := list(simplifyVariable(v) for v in var.children);
end simplifyVariable;

function simplifyBinding
Expand Down
4 changes: 4 additions & 0 deletions OMCompiler/Compiler/NFFrontEnd/NFUnitCheck.mo
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ protected
algorithm
for v in variables loop
(htCr2U, htS2U, htU2S, fnCache) := foldBindingExp(v, htCr2U, htS2U, htU2S, fnCache, dump_eq_unit);

for c in v.children loop
(htCr2U, htS2U, htU2S, fnCache) := foldBindingExp(c, htCr2U, htS2U, htU2S, fnCache, dump_eq_unit);
end for;
end for;

for eq in equations loop
Expand Down
1 change: 1 addition & 0 deletions OMCompiler/Compiler/NFFrontEnd/NFVariable.mo
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public
var.binding := Binding.mapExp(var.binding, fn);
var.typeAttributes := list(
(Util.tuple21(a), Binding.mapExp(Util.tuple22(a), fn)) for a in var.typeAttributes);
var.children := list(mapExp(v, fn) for v in var.children);
end mapExp;

function toString
Expand Down
4 changes: 4 additions & 0 deletions OMCompiler/Compiler/NFFrontEnd/NFVerifyModel.mo
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ protected
for attr in var.typeAttributes loop
verifyBinding(Util.tuple22(attr));
end for;

for v in var.children loop
verifyVariable(v);
end for;
end verifyVariable;

function verifyBinding
Expand Down

0 comments on commit df5af65

Please sign in to comment.