Skip to content

Commit

Permalink
Add recursive call for each parent class
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineGautier committed Dec 4, 2024
1 parent fc89f5c commit 0934078
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions client/src/interpreter/interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ const buildModsHelper = (

const typeOption = options[typeOptionPath as string];
if (typeOption && typeOption.options) {
// add modifiers from type option
// Add modifiers from type option
if (typeOption.modifiers) {
addToModObject(
typeOption.modifiers,
Expand All @@ -625,6 +625,25 @@ const buildModsHelper = (
mods,
);
}

// Each parent class must also be visited
// See https://github.com/lbl-srg/ctrl-flow-dev/issues/360
typeOption
.treeList
?.filter((path) => path !== (typeOptionPath as string)) // Exclude current class from being visited again
.map((oPath) => {
const o = options[oPath];
buildModsHelper(
o,
newBase,
mods,
options,
selections,
selectionModelicaPathsCache,
);
})

// Further populate `mods` with all options belonging to this class
typeOption.options.map((path) => {
const childOption = options[path];

Expand Down Expand Up @@ -655,12 +674,12 @@ export const buildMods = (
});

buildModsHelper(
startOption,
"",
mods,
options,
selections,
selectionModelicaPaths,
/* option */ startOption,
/* baseInstancePath */ "",
/* mods */ mods,
/* options */ options,
/* selections */ selections,
/* selectionModelicaPathsCache */ selectionModelicaPaths,
);

return mods;
Expand Down

0 comments on commit 0934078

Please sign in to comment.