Skip to content

Commit ed03422

Browse files
committed
[NF] Improve Expression.recordElement.
- Handle subscripted expressions properly in Expression.recordElement.
1 parent 64e28d6 commit ed03422

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

OMCompiler/Compiler/NFFrontEnd/NFExpression.mo

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5254,6 +5254,13 @@ public
52545254
then Expression.bindingExpMap(recordExp,
52555255
function recordElement(elementName = elementName));
52565256

5257+
case SUBSCRIPTED_EXP()
5258+
algorithm
5259+
outExp := recordElement(elementName, recordExp.exp);
5260+
then
5261+
SUBSCRIPTED_EXP(outExp, recordExp.subscripts,
5262+
Type.lookupRecordFieldType(elementName, recordExp.ty));
5263+
52575264
case EMPTY() then fail();
52585265

52595266
else

OMCompiler/Compiler/NFFrontEnd/NFType.mo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,8 @@ public
982982
fieldType := match recordType
983983
case COMPLEX()
984984
then InstNode.getType(Class.lookupElement(name, InstNode.getClass(recordType.cls)));
985+
case ARRAY()
986+
then liftArrayLeftList(lookupRecordFieldType(name, recordType.elementType), recordType.dimensions);
985987
end match;
986988
end lookupRecordFieldType;
987989

0 commit comments

Comments
 (0)