@@ -65,6 +65,7 @@ import NFFunction.TypedArg;
6565import NFInstNode.CachedData ;
6666import Operator = NFOperator ;
6767import Prefixes = NFPrefixes ;
68+ import Restriction = NFRestriction ;
6869import SCodeUtil ;
6970import SimplifyExp = NFSimplifyExp ;
7071import Subscript = NFSubscript ;
@@ -393,6 +394,11 @@ public
393394 if MatchedFunction . isVectorized(matchedFunc) then
394395 call := vectorizeCall(call, matchedFunc. mk, scope, info);
395396 end if ;
397+
398+ if Function . isExternal(func ) then
399+ updateExternalRecordArgs(args);
400+ updateExternalRecordArgsInType(ty);
401+ end if ;
396402 end matchTypedNormalCall;
397403
398404 function typeOf
@@ -1995,6 +2001,30 @@ public
19952001 end match;
19962002 end getNameAndArgs;
19972003
2004+ function updateExternalRecordArgs
2005+ input list< Expression > args;
2006+ algorithm
2007+ for arg in args loop
2008+ updateExternalRecordArgsInType(Expression . typeOf(arg));
2009+ end for ;
2010+ end updateExternalRecordArgs;
2011+
2012+ function updateExternalRecordArgsInType
2013+ input Type ty;
2014+ protected
2015+ InstNode node;
2016+ Class cls;
2017+ Restriction res;
2018+ algorithm
2019+ if Type . isRecord(ty) then
2020+ node := Type . complexNode(ty);
2021+ cls := InstNode . getClass(node);
2022+ res := Restriction . setExternalRecord(Class . restriction(cls));
2023+ cls := Class . setRestriction(res, cls);
2024+ InstNode . updateClass(cls, node);
2025+ end if ;
2026+ end updateExternalRecordArgsInType;
2027+
19982028protected
19992029 function instNormalCall
20002030 input Absyn . ComponentRef functionName;
0 commit comments