Skip to content

Commit c499df0

Browse files
author
Volker Waurich
committed
- fixed more models concerning partial function evaluation
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20514 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent e407b90 commit c499df0

File tree

4 files changed

+33
-8
lines changed

4 files changed

+33
-8
lines changed

Compiler/BackEnd/BackendDAEUtil.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2561,10 +2561,10 @@ algorithm outExp := matchcontinue(inExp)
25612561
//print("subscript for cref "+&stringDelimitList(List.map(sublstcref,ExpressionDump.printSubscriptStr)," / ")+&"\n");
25622562
subslst = dimensionsToRange(ad);
25632563
subslst1 = rangesToSubscripts(subslst);
2564-
//print("subscript for arraytype "+&intString(listLength(subslst1))+&stringDelimitList(List.map(List.flatten(subslst1),ExpressionDump.printSubscriptStr)," ; ")+&"\n");
2564+
//print("subscript for arraytype "+&intString(listLength(subslst1))+&" :"+&stringDelimitList(List.map(List.flatten(subslst1),ExpressionDump.printSubscriptStr)," ; ")+&"\n");
25652565
subslst = insertSubScripts(sublstcref,subslst1,{});
25662566
subslst1 = subslst;
2567-
//print("subscript for new cref "+&intString(listLength(subslst1))+&stringDelimitList(List.map(List.flatten(subslst1),ExpressionDump.printSubscriptStr)," / ")+&"\n");
2567+
//print("subscript for new cref "+&intString(listLength(subslst1))+&" :"+&stringDelimitList(List.map(List.flatten(subslst1),ExpressionDump.printSubscriptStr)," / ")+&"\n");
25682568
cr = ComponentReference.crefStripLastSubs(cr);
25692569
crlst = List.map1r(subslst1,ComponentReference.subscriptCref,cr);
25702570
//print(stringDelimitList(List.map(crlst,ComponentReference.debugPrintComponentRefTypeStr)," ; ")+&"\n");

Compiler/BackEnd/EvaluateFunctions.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ algorithm
412412
outputExp = setRecordTypes(outputExp,FUNCINFO(repl,funcs,idx));
413413
//print("RHS EXP:\n");
414414
//ExpressionDump.dumpExp(exp);
415-
Debug.bcall1(Flags.isSet(Flags.EVAL_FUNC_DUMP),print,"Finish evaluation in:\n"+&ExpressionDump.printExpStr(outputExp)+&" := "+&ExpressionDump.printExpStr(exp));
415+
Debug.bcall1(Flags.isSet(Flags.EVAL_FUNC_DUMP),print,"Finish evaluation in:\n"+&ExpressionDump.printExpStr(outputExp)+&" := "+&ExpressionDump.printExpStr(exp)+&"\n");
416416
Debug.bcall2(Flags.isSet(Flags.EVAL_FUNC_DUMP) and List.isNotEmpty(constEqs),BackendDump.dumpEquationList,constEqs,"including the additional equations:\n");
417417
then
418418
((exp,outputExp,constEqs,funcs,idx));
@@ -1466,7 +1466,7 @@ algorithm
14661466
lhsExps = List.fold1(stmts1,getStatementLHSScalar,funcTree,{});
14671467
lhsExps = List.unique(lhsExps);
14681468
lhsExpLst = List.map(lhsExps,Expression.getComplexContents); //consider arrays
1469-
lhsExps = List.flatten(lhsExpLst);
1469+
lhsExps = listAppend(List.flatten(lhsExpLst),lhsExps);
14701470
outputs = List.map(lhsExps,Expression.expCref);
14711471
repl = Debug.bcallret3(true, BackendVarTransform.removeReplacements,replIn,outputs,NONE(),replIn);
14721472

Compiler/FrontEnd/Expression.mo

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,7 @@ algorithm
15761576
DAE.ComponentRef cref;
15771577
DAE.Exp exp;
15781578
list<DAE.Exp> expLst;
1579+
list<list<DAE.Exp>> expLstLst;
15791580
list<DAE.ComponentRef> crefs;
15801581
case(DAE.CREF(componentRef=cref,ty=_))
15811582
equation
@@ -1587,14 +1588,17 @@ algorithm
15871588
then
15881589
expLst;
15891590
case(DAE.CALL(path=_,expLst=expLst,attr=_))
1590-
then
1591+
equation
1592+
expLstLst = List.map(expLst,getComplexContentsInCall);
1593+
expLst = List.flatten(expLstLst);
1594+
then
15911595
expLst;
15921596
case(DAE.RECORD(path=_,exps=expLst, comp=_,ty=_))
15931597
then
15941598
expLst;
15951599
case(DAE.ARRAY(ty=_,scalar=_,array=_))
15961600
equation
1597-
expLst = arrayElements(e);
1601+
expLst = arrayElements(e);
15981602
then
15991603
expLst;
16001604
case(DAE.TUPLE(PR=expLst))
@@ -1617,6 +1621,27 @@ algorithm
16171621
end match;
16181622
end getComplexContents;
16191623

1624+
protected function getComplexContentsInCall"gets the scalars for the complex expressions inside a function call"
1625+
input DAE.Exp expIn;
1626+
output list<DAE.Exp> expsOut;
1627+
algorithm
1628+
expsOut := matchcontinue(expIn)
1629+
local
1630+
list<DAE.Exp> expLst;
1631+
case(_)
1632+
equation
1633+
expLst = getComplexContents(expIn);
1634+
true = List.isEmpty(expLst);
1635+
then {expIn};
1636+
case(_)
1637+
equation
1638+
expLst = getComplexContents(expIn);
1639+
false = List.isEmpty(expLst);
1640+
then expLst;
1641+
else
1642+
then {};
1643+
end matchcontinue;
1644+
end getComplexContentsInCall;
16201645

16211646
public function getArrayOrRangeContents "returns the list of expressions in the array"
16221647
input DAE.Exp e;

Compiler/FrontEnd/Types.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,7 +2107,7 @@ algorithm
21072107
res = Absyn.pathString(ClassInf.getStateName(ci_state));
21082108
st_str = ClassInf.printStateStr(ci_state);
21092109
bc_tp_str = unparseType(bc_tp);
2110-
res = stringAppendList({"(",res," ",st_str," bc:",bc_tp_str,")"});
2110+
res = stringAppendList({"subType(",res," ",st_str," bc:",bc_tp_str,")"});
21112111
then
21122112
res;
21132113

@@ -2133,7 +2133,7 @@ algorithm
21332133
equation
21342134
tystrs = List.map(tys, unparseType);
21352135
tystr = stringDelimitList(tystrs, ", ");
2136-
res = stringAppendList({"(",tystr,")"});
2136+
res = stringAppendList({"TUPLE(",tystr,")"});
21372137
then
21382138
res;
21392139

0 commit comments

Comments
 (0)