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

[NF] Fix flattening of bindings. #2455

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 6 additions & 9 deletions Compiler/NFFrontEnd/NFFlatten.mo
Expand Up @@ -454,15 +454,12 @@ algorithm

case Binding.TYPED_BINDING()
algorithm
bind_exp := binding.bindingExp;
pars := listRest(binding.parents);

// TODO: Optimize this, making a list of all subscripts in the prefix
// when only a few are needed is unnecessary.
if not binding.isEach then
pars := listRest(binding.parents);

if listEmpty(pars) then
return;
end if;

if not (binding.isEach or listEmpty(pars)) then
if isTypeAttribute then
pars := listRest(pars);
end if;
Expand All @@ -473,7 +470,6 @@ algorithm
end for;

if binding_level > 0 then
bind_exp := binding.bindingExp;
subs := listAppend(listReverse(s) for s in ComponentRef.subscriptsAll(prefix));
accum_subs := {};

Expand All @@ -487,9 +483,10 @@ algorithm
end for;

bind_exp := Expression.applySubscripts(accum_subs, bind_exp);
binding.bindingExp := bind_exp;
end if;
end if;

binding.bindingExp := flattenExp(bind_exp, prefix);
then
binding;

Expand Down