Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 92a4119

Browse files
Andreas HeuermannOpenModelica-Hudson
authored andcommitted
Handle complex equations in when statements.
Fix for ticket #4157 Belonging to [master]: - #3086
1 parent d9dbed6 commit 92a4119

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Compiler/Template/CodegenC.tpl

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5687,13 +5687,30 @@ match ty
56875687
else
56885688
error(sourceInfo(), 'No runtime support for this sort of array call: <%cref(left)%> = <%dumpExp(right,"\"")%>')
56895689
end match
5690+
case T_COMPLEX(varLst = varLst, complexClassType=RECORD(__)) then
5691+
let &preExp = buffer ""
5692+
let exp = daeExp(right, context, &preExp, &varDecls, &auxFunction)
5693+
let tmp = tempDecl(expTypeModelica(ty),&varDecls)
5694+
<<
5695+
<%preExp%>
5696+
<%tmp%> = <%exp%>;
5697+
<% varLst |> var as TYPES_VAR(__) =>
5698+
match var.ty
5699+
case T_ARRAY(__) then
5700+
copyArrayData(var.ty, '<%tmp%>._<%var.name%>', appendStringCref(var.name,left), context, &preExp, &varDecls, &auxFunction)
5701+
else
5702+
let varPart = contextCref(appendStringCref(var.name,left),context, &auxFunction)
5703+
'<%varPart%> = <%tmp%>._<%var.name%>;'
5704+
; separator="\n"
5705+
%>
5706+
>>
56905707
else
56915708
let &preExp = buffer ""
56925709
let exp = daeExp(right, context, &preExp, &varDecls, &auxFunction)
56935710
<<
56945711
<%preExp%>
56955712
<%cref(left)%> = <%exp%>;
5696-
>>
5713+
>>
56975714
end whenAssign;
56985715

56995716
template equationIfEquationAssign(SimEqSystem eq, Context context, Text &varDecls, Text &eqnsDecls, String modelNamePrefixStr)

0 commit comments

Comments
 (0)