Skip to content

Commit

Permalink
Handle complex equations in when statements.
Browse files Browse the repository at this point in the history
Fix for ticket #4157

Belonging to [master]:
  - OpenModelica/OMCompiler#3086
  • Loading branch information
AnHeuermann authored and OpenModelica-Hudson committed May 10, 2019
1 parent d9dbed6 commit 92a4119
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Compiler/Template/CodegenC.tpl
Expand Up @@ -5687,13 +5687,30 @@ match ty
else
error(sourceInfo(), 'No runtime support for this sort of array call: <%cref(left)%> = <%dumpExp(right,"\"")%>')
end match
case T_COMPLEX(varLst = varLst, complexClassType=RECORD(__)) then
let &preExp = buffer ""
let exp = daeExp(right, context, &preExp, &varDecls, &auxFunction)
let tmp = tempDecl(expTypeModelica(ty),&varDecls)
<<
<%preExp%>
<%tmp%> = <%exp%>;
<% varLst |> var as TYPES_VAR(__) =>
match var.ty
case T_ARRAY(__) then
copyArrayData(var.ty, '<%tmp%>._<%var.name%>', appendStringCref(var.name,left), context, &preExp, &varDecls, &auxFunction)
else
let varPart = contextCref(appendStringCref(var.name,left),context, &auxFunction)
'<%varPart%> = <%tmp%>._<%var.name%>;'
; separator="\n"
%>
>>
else
let &preExp = buffer ""
let exp = daeExp(right, context, &preExp, &varDecls, &auxFunction)
<<
<%preExp%>
<%cref(left)%> = <%exp%>;
>>
>>
end whenAssign;

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

0 comments on commit 92a4119

Please sign in to comment.