Skip to content

Commit

Permalink
- Fixed cevalBuiltinSizeMatrix to work on non-constant matrices.
Browse files Browse the repository at this point in the history
- Fixed elaboration of non-constant for-loop range limits.
- Added testcase DiagonalBlock for bug #1149.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4876 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Jan 28, 2010
1 parent 09d0305 commit e4cd649
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
25 changes: 11 additions & 14 deletions Compiler/Ceval.mo
Expand Up @@ -4113,33 +4113,30 @@ algorithm
(outCache,outValue,outInteractiveInteractiveSymbolTableOption):=
matchcontinue (inCache,inEnv,inExp,inBoolean,inInteractiveInteractiveSymbolTableOption,inMsg)
local
DAE.Attributes attr;
tuple<DAE.TType, Option<Absyn.Path>> tp;
DAE.Binding bind;
list<Integer> sizelst;
Values.Value v;
list<Env.Frame> env;
Env.Env env;
DAE.ComponentRef cr;
Boolean impl;
Option<Interactive.InteractiveSymbolTable> st,st_1;
Option<Interactive.InteractiveSymbolTable> st;
Msg msg;
DAE.Exp exp;
Env.Cache cache;
case (cache,env,DAE.CREF(componentRef = cr,ty = tp),impl,st,msg)
equation
(cache,attr,tp,bind,_,_) = Lookup.lookupVar(cache,env, cr);
sizelst = Types.getDimensionSizes(tp);
v = ValuesUtil.intlistToValue(sizelst);
then
(cache,v,st);
case (cache,env,exp,impl,st,msg)
equation
(cache,v,st_1) = ceval(cache,env, exp, impl, st, NONE, msg);
tp = Types.typeOfValue(v);
(cache,_,tp,_,_,_) = Lookup.lookupVar(cache,env, cr);
sizelst = Types.getDimensionSizes(tp);
v = ValuesUtil.intlistToValue(sizelst);
then
(cache,v,st);
case (cache, env, DAE.MATRIX(ty = DAE.ET_ARRAY(arrayDimensions = dims)), impl, st, msg)
local
list<Option<Integer>> dims;
equation
sizelst = Util.listMap(dims, Util.getOption);
v = ValuesUtil.intlistToValue(sizelst);
then
(cache, v, st);
end matchcontinue;
end cevalBuiltinSizeMatrix;

Expand Down
11 changes: 6 additions & 5 deletions Compiler/Static.mo
Expand Up @@ -1965,12 +1965,13 @@ algorithm
then
(cache,(
DAE.T_ARRAY(DAE.DIM(SOME(n_2)),(DAE.T_REAL({}),NONE)),NONE));
case (cache,_,_,_,_,const,DAE.ET_INT(),(impl as true))
then (cache,(DAE.T_ARRAY(DAE.DIM(NONE),(DAE.T_INTEGER({}),NONE)), NONE));

case (cache,_,_,_,_,const,DAE.ET_REAL(),(impl as true))
then (cache,(DAE.T_ARRAY(DAE.DIM(NONE),(DAE.T_REAL({}),NONE)),NONE));

case (cache,_,_,_,_,const,DAE.ET_INT(),_)
then (cache,(DAE.T_ARRAY(DAE.DIM(NONE),(DAE.T_INTEGER({}),NONE)), NONE));

case (cache,_,_,_,_,const,DAE.ET_REAL(),_)
then (cache,(DAE.T_ARRAY(DAE.DIM(NONE),(DAE.T_REAL({}),NONE)),NONE));

case (cache,env,start,step,stop,const,expty,impl)
local Option<DAE.Exp> step;
equation
Expand Down

0 comments on commit e4cd649

Please sign in to comment.