Skip to content

Commit ce9c49d

Browse files
authored
Merge pull request #410 from lbl-srg/issue360_finalKeyword
Add recursive call for each parent class
2 parents b86ef85 + 0934078 commit ce9c49d

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

client/src/interpreter/interpreter.ts

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ const buildModsHelper = (
616616

617617
const typeOption = options[typeOptionPath as string];
618618
if (typeOption && typeOption.options) {
619-
// add modifiers from type option
619+
// Add modifiers from type option
620620
if (typeOption.modifiers) {
621621
addToModObject(
622622
typeOption.modifiers,
@@ -625,6 +625,25 @@ const buildModsHelper = (
625625
mods,
626626
);
627627
}
628+
629+
// Each parent class must also be visited
630+
// See https://github.com/lbl-srg/ctrl-flow-dev/issues/360
631+
typeOption
632+
.treeList
633+
?.filter((path) => path !== (typeOptionPath as string)) // Exclude current class from being visited again
634+
.map((oPath) => {
635+
const o = options[oPath];
636+
buildModsHelper(
637+
o,
638+
newBase,
639+
mods,
640+
options,
641+
selections,
642+
selectionModelicaPathsCache,
643+
);
644+
})
645+
646+
// Further populate `mods` with all options belonging to this class
628647
typeOption.options.map((path) => {
629648
const childOption = options[path];
630649

@@ -655,12 +674,12 @@ export const buildMods = (
655674
});
656675

657676
buildModsHelper(
658-
startOption,
659-
"",
660-
mods,
661-
options,
662-
selections,
663-
selectionModelicaPaths,
677+
/* option */ startOption,
678+
/* baseInstancePath */ "",
679+
/* mods */ mods,
680+
/* options */ options,
681+
/* selections */ selections,
682+
/* selectionModelicaPathsCache */ selectionModelicaPaths,
664683
);
665684

666685
return mods;

0 commit comments

Comments
 (0)