Skip to content

Commit

Permalink
- compare types before inline expression
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@11240 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Feb 29, 2012
1 parent 0461f31 commit 4110066
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Compiler/FrontEnd/Inline.mo
Expand Up @@ -1020,6 +1020,7 @@ algorithm
list<tuple<DAE.ComponentRef, DAE.Exp>> argmap;
DAE.Exp newExp,newExp1, e1;
DAE.InlineType inlineType;
DAE.Type ty1,ty2;
case ((e1 as DAE.CALL(p,args,DAE.CALL_ATTR(inlineType=inlineType)),(fns,_)))
equation
true = DAEUtil.convertInlineTypeToBool(inlineType);
Expand All @@ -1030,6 +1031,10 @@ algorithm
argmap = List.threadTuple(crefs,args);
argmap = extendCrefRecords(argmap);
newExp = getRhsExp(fn);
// compare types
ty1 = Expression.typeof(e1);
ty2 = Expression.typeof(newExp);
true = Types.equivtypes(ty1,ty2);
((newExp,argmap)) = Expression.traverseExp(newExp,replaceArgs,argmap);
// for inlinecalls in functions
((newExp1,(fns1,_))) = Expression.traverseExp(newExp,inlineCall,(fns,true));
Expand Down Expand Up @@ -1057,6 +1062,7 @@ algorithm
list<tuple<DAE.ComponentRef, DAE.Exp>> argmap;
DAE.Exp newExp,newExp1, e1;
DAE.InlineType inlineType;
DAE.Type ty1,ty2;
case ((e1 as DAE.CALL(p,args,DAE.CALL_ATTR(inlineType=inlineType)),(fns,_)))
equation
fn = getFunctionBody(p,fns);
Expand All @@ -1066,6 +1072,10 @@ algorithm
argmap = extendCrefRecords(argmap);
newExp = getRhsExp(fn);
((newExp,argmap)) = Expression.traverseExp(newExp,replaceArgs,argmap);
// compare types
ty1 = Expression.typeof(e1);
ty2 = Expression.typeof(newExp);
true = Types.equivtypes(ty1,ty2);
// for inlinecalls in functions
((newExp1,(fns1,_))) = Expression.traverseExp(newExp,forceInlineCall,(fns,true));
then
Expand Down

0 comments on commit 4110066

Please sign in to comment.