Skip to content

Commit

Permalink
- Add code to codegen/dump cast to record types
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13866 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 12, 2012
1 parent ac81a22 commit 413c8ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions Compiler/Template/CodegenC.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7119,6 +7119,7 @@ case CAST(__) then
let from = expTypeFromExpShort(exp)
let &preExp += 'cast_<%from%>_array_to_<%to%>(&<%expVar%>, &<%tvar%>);<%\n%>'
'<%tvar%>'
case T_COMPLEX(complexClassType=rec as RECORD(__)) then '(*((struct <%underscorePath(rec.path)%>*)&<%expVar%>))'
else
'(<%expVar%>) /* could not cast, using the variable as it is */'
end daeExpCast;
Expand Down
5 changes: 5 additions & 0 deletions Compiler/Template/ExpressionDumpTpl.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ match exp
case TUPLE(__) then
let tuple_str = dumpExpList(PR, stringDelimiter, ", ")
'(<%tuple_str%>)'
case CAST(ty=DAE.T_COMPLEX(__)) then
/* TODO: Add this. Keep it not to mess with flat code for now */
let exp_str = dumpExp(exp, stringDelimiter)
let ty_str = dumpType(ty)
'<% if typeinfo() then '/*<%ty_str%>*/'%><%exp_str%>'
case CAST(__) then
let exp_str = dumpExp(exp, stringDelimiter)
let ty_str = dumpType(ty)
Expand Down

0 comments on commit 413c8ea

Please sign in to comment.