Skip to content

Commit

Permalink
- fix numArrayElement for temp array simVars.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18481 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Willi Braun committed Dec 13, 2013
1 parent 265602c commit 1f2c13d
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions Compiler/BackEnd/SimCodeUtil.mo
Expand Up @@ -3334,10 +3334,12 @@ algorithm
local
list<DAE.Exp> rest, expl;
DAE.Type ty;
DAE.ComponentRef cr, arraycr;
DAE.ComponentRef cr;
SimCode.SimVar var;
Option<DAE.ComponentRef> arrayCref;
list<SimCode.SimVar> tempvars;
list<DAE.Subscript> inst_dims;
list<String> numArrayElement;

case({}, _) then itempvars;

Expand All @@ -3356,7 +3358,9 @@ algorithm
case(DAE.CREF(cr, ty)::rest, _)
equation
arrayCref = getArrayCref(cr);
var = SimCode.SIMVAR(cr, BackendDAE.VARIABLE(), "", "", "", 0, NONE(), NONE(), NONE(), NONE(), false, ty, false, arrayCref, SimCode.NOALIAS(), DAE.emptyElementSource, SimCode.NONECAUS(), NONE(), {}, false);
inst_dims = getArraySubs(cr);
numArrayElement = List.map(inst_dims, ExpressionDump.subscriptString);
var = SimCode.SIMVAR(cr, BackendDAE.VARIABLE(), "", "", "", 0, NONE(), NONE(), NONE(), NONE(), false, ty, false, arrayCref, SimCode.NOALIAS(), DAE.emptyElementSource, SimCode.NONECAUS(), NONE(), numArrayElement, false);
then
greateTempVarsforCrefs(rest, var::itempvars);
end match;
Expand Down Expand Up @@ -8640,6 +8644,23 @@ algorithm
end matchcontinue;
end getArrayCref;

public function getArraySubs
input DAE.ComponentRef name;
output list<DAE.Subscript> arraySubs;
algorithm
(arraySubs) :=
matchcontinue (name)
local
list<DAE.Subscript> arrayCrefSubs;
case (_)
equation
arrayCrefSubs = ComponentReference.crefSubs(name);
then arrayCrefSubs;
case (_)
then {};
end matchcontinue;
end getArraySubs;

protected function unparseCommentOptionNoAnnotationNoQuote
input Option<SCode.Comment> absynComment;
output String commentStr;
Expand Down

0 comments on commit 1f2c13d

Please sign in to comment.