Skip to content

Commit

Permalink
Fixed the piece to add host model DDT entries recursivelygit add ddt_…
Browse files Browse the repository at this point in the history
…library.py!
  • Loading branch information
dustinswales committed Sep 26, 2024
1 parent ace5f1a commit 40deb94
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/ddt_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def check_ddt_type(self, var, header, lname=None):
# end if (no else needed)

def collect_ddt_fields(self, var_dict, var, run_env,
ddt=None, skip_duplicates=False):
ddt=None, skip_duplicates=False, parent=None):
"""Add all the reachable fields from DDT variable <var> of type,
<ddt> to <var_dict>. Each field is added as a VarDDT.
Note: By default, it is an error to try to add a duplicate
Expand All @@ -267,12 +267,16 @@ def collect_ddt_fields(self, var_dict, var, run_env,
# end if
# end if
for dvar in ddt.variable_list():
subvar = VarDDT(dvar, var, self.run_env)
if parent is None:
subvar = VarDDT(dvar, var, self.run_env)
else:
subvar = VarDDT(VarDDT(dvar, var, self.run_env), parent, self.run_env)
# end if
dvtype = dvar.get_prop_value('type')
if (dvar.is_ddt()) and (dvtype in self):
# If DDT in our library, we need to add sub-fields recursively.
subddt = self[dvtype]
self.collect_ddt_fields(var_dict, subvar, run_env, ddt=subddt)
self.collect_ddt_fields(var_dict, dvar, run_env, parent=var, ddt=subddt)
# end if
# add_variable only checks the current dictionary. By default,
# for a DDT, the variable also cannot be in our parent
Expand Down

0 comments on commit 40deb94

Please sign in to comment.