Skip to content

Commit

Permalink
- Unlifts both sides of the equation in Inst.instArrayElEq, so that t…
Browse files Browse the repository at this point in the history
…heir type

  is correct.
- Added testcase mosfiles/ArraySlice.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5914 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Aug 12, 2010
1 parent f3ae7f3 commit 55d6d0b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Compiler/Exp.mo
Expand Up @@ -5185,6 +5185,40 @@ algorithm
end matchcontinue;
end unliftArray;

public function unliftExp
input Exp inExp;
output Exp outExp;
algorithm
outExp := matchcontinue(inExp)
local
Type ty;
case DAE.CREF(componentRef = cr, ty = ty)
local
DAE.ComponentRef cr;
equation
ty = unliftArray(ty);
then
DAE.CREF(cr, ty);
case DAE.ARRAY(ty = ty, scalar = s, array = a)
local
Boolean s;
list<Exp> a;
equation
ty = unliftArray(ty);
then
DAE.ARRAY(ty, s, a);
case DAE.MATRIX(ty = ty, integer = i, scalar = s)
local
Integer i;
list<list<tuple<Exp, Boolean>>> s;
equation
ty = unliftArray(ty);
then
DAE.MATRIX(ty, i, s);
case (_) then inExp;
end matchcontinue;
end unliftExp;

public function isWholeDim ""
input DAE.Subscript s;
output Boolean b;
Expand Down
2 changes: 2 additions & 0 deletions Compiler/Inst.mo
Expand Up @@ -12164,7 +12164,9 @@ algorithm
(i <= sz) = true;
ae1 = DAE.ICONST(i);
e1_1 = Exp.simplify(DAE.ASUB(e1,{ae1}));
e1_1 = Exp.unliftExp(e1_1);
e2_1 = Exp.simplify(DAE.ASUB(e2,{ae1}));
e2_1 = Exp.unliftExp(e2_1);
dae1 = instEqEquation2(e1_1, e2_1, t, source, initial_);
i_1 = i + 1;
dae2 = instArrayElEq(e1, e2, t, i_1, sz, source, initial_);
Expand Down

0 comments on commit 55d6d0b

Please sign in to comment.