Skip to content

Commit

Permalink
#2896 Fix simplify asub when array<T> types are involved
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@22766 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 16, 2014
1 parent f118ef0 commit 6a2360f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Compiler/FrontEnd/Expression.mo
Expand Up @@ -1066,6 +1066,10 @@ algorithm
then tp;
case (DAE.T_ARRAY(ty = tp,dims = (_ :: ds),source = ts))
then DAE.T_ARRAY(tp,ds,ts);
case (DAE.T_METATYPE(ty = tp))
then Types.simplifyType(unliftArray(tp));
case (DAE.T_METAARRAY(ty = tp))
then tp;
else inType;
end match;
end unliftArray;
Expand Down
7 changes: 7 additions & 0 deletions Compiler/FrontEnd/ExpressionSimplify.mo
Expand Up @@ -2902,9 +2902,16 @@ algorithm
then
e;

case(DAE.CREF(c,DAE.T_METATYPE(ty=DAE.T_METAARRAY(ty=t))), _, _)
equation
t = Types.simplifyType(t);
exp = Expression.makeBuiltinCall("arrayGet",{ie,inSubExp},t,false);
then exp;

// name subscript
case(DAE.CREF(c,t), _, _)
equation
true = Types.isArray(t,{});
t = Expression.unliftArray(t);
c_1 = simplifyAsubCref(c, inSubExp);
exp = Expression.makeCrefExp(c_1, t);
Expand Down

0 comments on commit 6a2360f

Please sign in to comment.