Skip to content

Commit e4a3890

Browse files
committed
Don't expand records with --newBackend.
1 parent f6d7f17 commit e4a3890

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

OMCompiler/Compiler/NFFrontEnd/NFFlatten.mo

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ uniontype FlattenSettings
128128
Boolean scalarize;
129129
Boolean arrayConnect;
130130
Boolean nfAPI;
131+
Boolean newBackend;
131132
end SETTINGS;
132133
end FlattenSettings;
133134

@@ -147,7 +148,8 @@ algorithm
147148
settings := FlattenSettings.SETTINGS(
148149
Flags.isSet(Flags.NF_SCALARIZE),
149150
Flags.isSet(Flags.ARRAY_CONNECT),
150-
Flags.isSet(Flags.NF_API)
151+
Flags.isSet(Flags.NF_API),
152+
Flags.getConfigBool(Flags.NEW_BACKEND)
151153
);
152154

153155
sections := Sections.EMPTY();
@@ -289,7 +291,7 @@ algorithm
289291
cls := InstNode.getClass(c.classInst);
290292
vis := if InstNode.isProtected(component) then Visibility.PROTECTED else visibility;
291293

292-
if isComplexComponent(ty) then
294+
if isComplexComponent(ty, settings) then
293295
(vars, sections) := flattenComplexComponent(comp_node, c, cls, ty,
294296
vis, outerBinding, prefix, vars, sections, settings);
295297
else
@@ -394,12 +396,14 @@ end deleteClassComponents;
394396

395397
function isComplexComponent
396398
input Type ty;
399+
input FlattenSettings settings;
397400
output Boolean isComplex;
398401
algorithm
399402
isComplex := match ty
400403
case Type.COMPLEX(complexTy = ComplexType.EXTERNAL_OBJECT()) then false;
404+
case Type.COMPLEX(complexTy = ComplexType.RECORD()) then not settings.newBackend;
401405
case Type.COMPLEX() then true;
402-
case Type.ARRAY() then isComplexComponent(ty.elementType);
406+
case Type.ARRAY() then isComplexComponent(ty.elementType, settings);
403407
else false;
404408
end match;
405409
end isComplexComponent;

0 commit comments

Comments
 (0)