Skip to content

Commit

Permalink
Create correct array types for complex type using the prefix dim info.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@22370 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
mahge committed Sep 19, 2014
1 parent 3d6fa34 commit 77735d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/Inst.mo
Expand Up @@ -3672,7 +3672,7 @@ algorithm
comp = SCode.COMPONENT(name, prefixes, attr, ts, m, comment, cond, info);
ci_state = ClassInf.trans(ci_state, ClassInf.FOUND_COMPONENT(name));
cref = ComponentReference.makeCrefIdent(name, DAE.T_UNKNOWN_DEFAULT, {});
(cache,_) = PrefixUtil.prefixCref(cache, env, ih, pre, cref);
(cache,_) = PrefixUtil.prefixCref(cache, env, ih, pre, cref); /*mahge: todo: remove me*/

// The class definition is fetched from the environment. Then the set of
// modifications is calculated. The modificions is the result of merging
Expand Down
12 changes: 8 additions & 4 deletions Compiler/FrontEnd/PrefixUtil.mo
Expand Up @@ -364,6 +364,8 @@ algorithm
DAE.ComponentRef cref,cref_1,cref_2,cref_;
String i;
list<DAE.Subscript> s;
list<DAE.Dimension> ds;
DAE.Type ident_ty;
Prefix.ComponentPrefix xs;
Prefix.ClassPrefix cp;
ClassInf.State ci_state;
Expand All @@ -375,16 +377,18 @@ algorithm

case (cache,_,_,Prefix.NOPRE(),SOME(cref)) then (cache,cref);
case (cache,_,_,Prefix.PREFIX(Prefix.NOCOMPPRE(),_),SOME(cref)) then (cache,cref);
case (cache,env,_,Prefix.PREFIX(Prefix.PRE(prefix = i,subscripts = s,next = xs,ci_state=ci_state),cp),NONE())
case (cache,env,_,Prefix.PREFIX(Prefix.PRE(prefix = i,dimensions=ds,subscripts = s,next = xs,ci_state=ci_state),cp),NONE())
equation
cref_ = ComponentReference.makeCrefIdent(i,DAE.T_COMPLEX(ci_state, {}, NONE(), DAE.emptyTypeSource),s);
ident_ty = Expression.liftArrayLeftList(DAE.T_COMPLEX(ci_state, {}, NONE(), DAE.emptyTypeSource), ds);
cref_ = ComponentReference.makeCrefIdent(i,ident_ty,s);
(cache,cref_1) = prefixToCref2(cache,env,inIH,Prefix.PREFIX(xs,cp), SOME(cref_));
then
(cache,cref_1);
case (cache,env,_,Prefix.PREFIX(Prefix.PRE(prefix = i,subscripts = s,next = xs,ci_state=ci_state),cp),SOME(cref))
case (cache,env,_,Prefix.PREFIX(Prefix.PRE(prefix = i,dimensions=ds,subscripts = s,next = xs,ci_state=ci_state),cp),SOME(cref))
equation
(cache,cref) = prefixSubscriptsInCref(cache,env,inIH,inPrefix,cref);
cref_2 = ComponentReference.makeCrefQual(i,DAE.T_COMPLEX(ci_state, {}, NONE(), DAE.emptyTypeSource),s,cref);
ident_ty = Expression.liftArrayLeftList(DAE.T_COMPLEX(ci_state, {}, NONE(), DAE.emptyTypeSource), ds);
cref_2 = ComponentReference.makeCrefQual(i,ident_ty,s,cref);
(cache,cref_1) = prefixToCref2(cache,env,inIH,Prefix.PREFIX(xs,cp), SOME(cref_2));
then
(cache,cref_1);
Expand Down

0 comments on commit 77735d5

Please sign in to comment.