Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit f9d9de0

Browse files
vrugeOpenModelica-Hudson
authored andcommitted
fixed inline
- output variables can have a binding like protected variables - create from binding of outputs new Statement refs ticket4808 Belonging to [master]: - #2310 - OpenModelica/OpenModelica-testsuite#893
1 parent 69ee163 commit f9d9de0

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Compiler/FrontEnd/Inline.mo

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,10 @@ algorithm
860860
// depend on detection of assert or not
861861
if (listEmpty(assrtStmts))
862862
then // no assert detected
863+
863864
// output
864865
newExp = Expression.makeTuple(list( getReplacementCheckComplex(repl,cr,ty) for cr in lst_cr));
866+
865867
// compare types
866868
true = checkExpsTypeEquiv(e1, newExp);
867869
// input map cref again function args
@@ -1126,17 +1128,31 @@ algorithm
11261128
Option<DAE.Exp> binding;
11271129
DAE.Type tp;
11281130
DAE.Element elt;
1131+
DAE.Exp exp;
11291132
case ({},_,_,_,_) then (listReverse(iInputs),listReverse(iOutput),iBody,iRepl);
11301133
case (DAE.VAR(componentRef=cr,direction=DAE.INPUT())::rest,_,_,_,_)
11311134
equation
11321135
(oInputs,oOutput,oBody,repl) = getFunctionInputsOutputBody(rest,cr::iInputs,iOutput,iBody,iRepl);
11331136
then
11341137
(oInputs,oOutput,oBody,repl);
1135-
case (DAE.VAR(componentRef=cr,direction=DAE.OUTPUT())::rest,_,_,_,_)
1138+
1139+
case (DAE.VAR(componentRef=cr,direction=DAE.OUTPUT(), binding=binding as SOME(exp))::rest,_,_,_,_)
1140+
equation
1141+
// use type of cref, since var type is different
1142+
// and has no hint on array or record type
1143+
tp = ComponentReference.crefTypeFull(cr);
1144+
st = listAppend(iBody, {DAE.STMT_ASSIGN(exp1 = Expression.crefExp(cr), exp = exp, source=DAE.emptyElementSource, type_=tp)});
1145+
(oInputs,oOutput,oBody,repl) = getFunctionInputsOutputBody(rest,iInputs,cr::iOutput,st,iRepl);
1146+
then
1147+
(oInputs,oOutput,oBody,repl);
1148+
1149+
1150+
case (DAE.VAR(componentRef=cr,direction=DAE.OUTPUT(), binding=NONE())::rest,_,_,_,_)
11361151
equation
11371152
(oInputs,oOutput,oBody,repl) = getFunctionInputsOutputBody(rest,iInputs,cr::iOutput,iBody,iRepl);
11381153
then
11391154
(oInputs,oOutput,oBody,repl);
1155+
11401156
case (DAE.VAR(componentRef=cr,protection=DAE.PROTECTED(),binding=binding)::rest,_,_,_,_)
11411157
equation
11421158
// use type of cref, since var type is different
@@ -1729,6 +1745,7 @@ algorithm
17291745
exps = List.map1r(crs, VarTransform.getReplacement, repl);
17301746
then DAE.CALL(path,exps,DAE.CALL_ATTR(ty,false,false,false,false,DAE.NO_INLINE(),DAE.NO_TAIL()));
17311747
end matchcontinue;
1748+
17321749
end getReplacementCheckComplex;
17331750

17341751
protected function getInlineHashTableVarTransform

0 commit comments

Comments
 (0)