The following is dead code and can be remove.
if (typeof myoperand === "string" && !/^".*"$/.test(operand)) {
const element =
typeStore.get(myoperand, basePath) || typeStore.get(myoperand, baseType);
// Only expand if it's a definition (enum, type, etc.), not an instance parameter
const isDefinition =
element && !["component_clause", "import_clause"].includes(element.elementType);
myoperand = isDefinition ? element.modelicaPath : myoperand;
}
Tracing through the possible cases for myoperand reaching the if block:
-
Fully qualified type paths (e.g. "Buildings.Fluid.Types.HeatExchangerConfiguration") — typeStore.get finds the Enumeration element, isDefinition = true, but element.modelicaPath === myoperand already, so no change.
-
Import aliases (e.g. "con") — typeStore.get finds the Import element, but elementType === "import_clause" → isDefinition = false, no change.
-
Local parameter references (e.g. "typCtlFanRet") — found as component_clause → isDefinition = false, no change.
-
Enum values (e.g. "...HeatExchangerConfiguration.CounterFlow") — _get splits to name="CounterFlow", parent=Enumeration, isInputGroup("type") = false → while loop never runs → typeStore.get returns undefined → isDefinition = false, no change.
-
MLS predefined types / unparseable paths — typeStore.get returns undefined or bails early, no change.
There is no realistic code path in the Buildings library where element is found, isDefinition is true, AND element.modelicaPath !== myoperand.
And indeed, removing this block has no effect on templates.json.
The following is dead code and can be remove.
Tracing through the possible cases for
myoperandreaching theifblock:Fully qualified type paths (e.g.
"Buildings.Fluid.Types.HeatExchangerConfiguration") —typeStore.getfinds theEnumerationelement,isDefinition = true, butelement.modelicaPath === myoperandalready, so no change.Import aliases (e.g.
"con") —typeStore.getfinds theImportelement, butelementType === "import_clause"→isDefinition = false, no change.Local parameter references (e.g.
"typCtlFanRet") — found ascomponent_clause→isDefinition = false, no change.Enum values (e.g.
"...HeatExchangerConfiguration.CounterFlow") —_getsplits to name="CounterFlow", parent=Enumeration,isInputGroup("type") = false→ while loop never runs →typeStore.getreturnsundefined→isDefinition = false, no change.MLS predefined types / unparseable paths —
typeStore.getreturnsundefinedor bails early, no change.There is no realistic code path in the Buildings library where
elementis found,isDefinitionis true, ANDelement.modelicaPath !== myoperand.And indeed, removing this block has no effect on
templates.json.