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

Commit ec69d30

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
Applied the refactoring script
This removes some dead code and makes it easier to read the code to figure out what is happening.
1 parent ec7206f commit ec69d30

30 files changed

+90
-98
lines changed

Compiler/BackEnd/BackendDAECreate.mo

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,13 +1004,13 @@ algorithm
10041004
nameen = Absyn.joinPaths(inPath, Absyn.IDENT(sn));
10051005
then
10061006
DAEUtil.setMinMax(inVarAttr, SOME(DAE.ENUM_LITERAL(namee1, 1)), SOME(DAE.ENUM_LITERAL(nameen, i)));
1007-
case (NONE(), SOME(e), _, _, _)
1007+
case (NONE(), SOME(_), _, _, _)
10081008
equation
10091009
s1 = listHead(inNames);
10101010
namee1 = Absyn.joinPaths(inPath, Absyn.IDENT(s1));
10111011
then
10121012
DAEUtil.setMinMax(inVarAttr, SOME(DAE.ENUM_LITERAL(namee1, 1)), inMax);
1013-
case (SOME(e), NONE(), _, _, _)
1013+
case (SOME(_), NONE(), _, _, _)
10141014
equation
10151015
i = listLength(inNames);
10161016
sn = listGet(inNames, i);
@@ -1962,7 +1962,7 @@ algorithm
19621962
(eqnl, reqnl);
19631963

19641964
// if a function call includes external functions, it is not allowed to expand the left hand side since the call will be evaluated multiple times. That's an unintended behaviour.
1965-
case DAE.EQUATION(exp = lhs as DAE.TUPLE(PR=_), scalar = e as DAE.CALL(_), source = source)::xs
1965+
case DAE.EQUATION(exp = lhs as DAE.TUPLE(), scalar = e as DAE.CALL(_), source = source)::xs
19661966
equation
19671967
//print("Do not lower equations with function calls that solve tuples "+DAEDump.dumpEquationStr(listHead(inDAEElementLst))+"\n");
19681968
ty = Expression.typeof(lhs);
@@ -1980,7 +1980,7 @@ algorithm
19801980
then
19811981
(eqnl, reqnl);
19821982

1983-
case (el as DAE.EQUATION(exp = (cre as DAE.CREF(componentRef = _)), scalar = e, source = source))::xs algorithm
1983+
case (el as DAE.EQUATION(exp = (cre as DAE.CREF()), scalar = e, source = source))::xs algorithm
19841984
try
19851985
e := ExpressionSolve.solve(cre, e, cre);
19861986
else
@@ -1994,7 +1994,7 @@ algorithm
19941994
(eqnl, reqnl) := lowerWhenEqn2(xs, inCond, functionTree, eq::iEquationLst, iREquationLst);
19951995
then (eqnl, reqnl);
19961996

1997-
case DAE.COMPLEX_EQUATION(lhs = (cre as DAE.CREF(componentRef = _)), rhs = e, source = source)::xs
1997+
case DAE.COMPLEX_EQUATION(lhs = (cre as DAE.CREF()), rhs = e, source = source)::xs
19981998
equation
19991999
(DAE.EQUALITY_EXPS(_,e), source) = ExpressionSimplify.simplifyAddSymbolicOperation(DAE.EQUALITY_EXPS(cre,e),source);
20002000
size = Expression.sizeOf(Expression.typeof(cre));
@@ -2029,7 +2029,7 @@ algorithm
20292029
then
20302030
(eqnl, reqnl);
20312031

2032-
case DAE.ARRAY_EQUATION(dimension=ds, exp = (cre as DAE.CREF(componentRef = _)), array = e, source = source)::xs
2032+
case DAE.ARRAY_EQUATION(dimension=ds, exp = (cre as DAE.CREF()), array = e, source = source)::xs
20332033
equation
20342034
(DAE.EQUALITY_EXPS(_,e), source) = ExpressionSimplify.simplifyAddSymbolicOperation(DAE.EQUALITY_EXPS(cre,e),source);
20352035
size = List.fold(Expression.dimensionsSizes(ds), intMul, 1);

Compiler/BackEnd/BackendDAEOptimize.mo

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ algorithm
503503
equation
504504
(_::_,_::_)= BackendVariable.getVar(cr, vars);
505505
then (e,false,(true,vars,globalKnownVars,b1,true));
506-
case (e,(b,vars,globalKnownVars,b1,b2)) then (e,not b,inTpl);
506+
case (e,(b,_,_,_,_)) then (e,not b,inTpl);
507507

508508
end matchcontinue;
509509
end traversingTimeEqnsFinder;
@@ -5909,7 +5909,7 @@ algorithm
59095909
list<BackendDAE.Equation> eqnLst;
59105910
Boolean hasHomotopy;
59115911

5912-
case(BackendDAE.SINGLEEQUATION(eqn=eqnIndex, var=varIndex))
5912+
case(BackendDAE.SINGLEEQUATION(eqn=eqnIndex))
59135913
equation
59145914
eqn = BackendEquation.get(system.orderedEqs, eqnIndex);
59155915
(_, hasHomotopy) = BackendEquation.traverseExpsOfEquation(eqn, BackendDAEUtil.containsHomotopyCall, false);
@@ -5921,7 +5921,7 @@ algorithm
59215921
end if;
59225922
then();
59235923

5924-
case(BackendDAE.EQUATIONSYSTEM(eqns=eqnIndexes, vars=varIndexes))
5924+
case(BackendDAE.EQUATIONSYSTEM(eqns=eqnIndexes))
59255925
equation
59265926
if (homotopyLoopBeginning == 0) then
59275927
eqnLst = BackendEquation.getList(eqnIndexes, system.orderedEqs);
@@ -5936,7 +5936,7 @@ algorithm
59365936
end if;
59375937
then();
59385938

5939-
case(BackendDAE.SINGLEARRAY(eqn=eqnIndex, vars=varIndexes))
5939+
case(BackendDAE.SINGLEARRAY(eqn=eqnIndex))
59405940
equation
59415941
eqn = BackendEquation.get(system.orderedEqs, eqnIndex);
59425942
(_, hasHomotopy) = BackendEquation.traverseExpsOfEquation(eqn, BackendDAEUtil.containsHomotopyCall, false);
@@ -5949,7 +5949,7 @@ algorithm
59495949
end if;
59505950
then();
59515951

5952-
case(BackendDAE.SINGLEALGORITHM(eqn=eqnIndex, vars=varIndexes))
5952+
case(BackendDAE.SINGLEALGORITHM(eqn=eqnIndex))
59535953
equation
59545954
eqn = BackendEquation.get(system.orderedEqs, eqnIndex);
59555955
(_, hasHomotopy) = BackendEquation.traverseExpsOfEquation(eqn, BackendDAEUtil.containsHomotopyCall, false);
@@ -5962,7 +5962,7 @@ algorithm
59625962
end if;
59635963
then();
59645964

5965-
case(BackendDAE.SINGLECOMPLEXEQUATION(eqn=eqnIndex, vars=varIndexes))
5965+
case(BackendDAE.SINGLECOMPLEXEQUATION(eqn=eqnIndex))
59665966
equation
59675967
eqn = BackendEquation.get(system.orderedEqs, eqnIndex);
59685968
(_, hasHomotopy) = BackendEquation.traverseExpsOfEquation(eqn, BackendDAEUtil.containsHomotopyCall, false);
@@ -5975,7 +5975,7 @@ algorithm
59755975
end if;
59765976
then();
59775977

5978-
case(BackendDAE.SINGLEWHENEQUATION(eqn=eqnIndex, vars=varIndexes))
5978+
case(BackendDAE.SINGLEWHENEQUATION(eqn=eqnIndex))
59795979
equation
59805980
eqn = BackendEquation.get(system.orderedEqs, eqnIndex);
59815981
(_, hasHomotopy) = BackendEquation.traverseExpsOfEquation(eqn, BackendDAEUtil.containsHomotopyCall, false);
@@ -5988,7 +5988,7 @@ algorithm
59885988
end if;
59895989
then();
59905990

5991-
case(BackendDAE.SINGLEIFEQUATION(eqn=eqnIndex, vars=varIndexes))
5991+
case(BackendDAE.SINGLEIFEQUATION(eqn=eqnIndex))
59925992
equation
59935993
eqn = BackendEquation.get(system.orderedEqs, eqnIndex);
59945994
(_, hasHomotopy) = BackendEquation.traverseExpsOfEquation(eqn, BackendDAEUtil.containsHomotopyCall, false);
@@ -6001,14 +6001,14 @@ algorithm
60016001
end if;
60026002
then();
60036003

6004-
case(BackendDAE.TORNSYSTEM(strictTearingSet=BackendDAE.TEARINGSET(residualequations=resEqnIndexes, tearingvars=tVarIndexes, innerEquations=innerEquations)))
6004+
case(BackendDAE.TORNSYSTEM(strictTearingSet=BackendDAE.TEARINGSET(residualequations=resEqnIndexes, innerEquations=innerEquations)))
60056005
equation
60066006
if (homotopyLoopBeginning == 0) then
60076007
eqnLst = BackendEquation.getList(resEqnIndexes, system.orderedEqs);
60086008
(_, hasHomotopy) = BackendEquation.traverseExpsOfEquationList(eqnLst, BackendDAEUtil.containsHomotopyCall, false);
60096009

60106010
if not hasHomotopy then
6011-
(innerEqnIndexes, innerVarIndexesLst,_) = List.map_3(innerEquations, BackendDAEUtil.getEqnAndVarsFromInnerEquation);
6011+
(innerEqnIndexes,_,_) = List.map_3(innerEquations, BackendDAEUtil.getEqnAndVarsFromInnerEquation);
60126012
eqnLst = BackendEquation.getList(innerEqnIndexes, system.orderedEqs);
60136013
(_, hasHomotopy) = BackendEquation.traverseExpsOfEquationList(eqnLst, BackendDAEUtil.containsHomotopyCall, false);
60146014
end if;

Compiler/BackEnd/BackendDAEUtil.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ algorithm
159159
BackendDAE.EqSystem syst;
160160
DAE.FunctionTree functionTree;
161161

162-
case BackendDAE.DAE(eqs=(syst as BackendDAE.EQSYSTEM(orderedVars=vars, orderedEqs=orderedEqs))::{}, shared=BackendDAE.SHARED(functionTree=functionTree)) equation
162+
case BackendDAE.DAE(eqs=(BackendDAE.EQSYSTEM(orderedVars=vars, orderedEqs=orderedEqs))::{}, shared=BackendDAE.SHARED(functionTree=_)) equation
163163
//true = Flags.isSet(Flags.CHECK_BACKEND_DAE);
164164
//Check for correct size
165165
nVars = BackendVariable.varsSize(vars);
@@ -4354,7 +4354,7 @@ algorithm
43544354
arrayUpdate(rowmark,i,-mark);
43554355
then
43564356
adjacencyRowAlgorithmInputs1(rest,mark,rowmark,(i,BackendDAE.SOLVABILITY_UNSOLVABLE(),{})::iRow);
4357-
case (i::rest,_,_,_)
4357+
case (_::rest,_,_,_)
43584358
then
43594359
adjacencyRowAlgorithmInputs1(rest,mark,rowmark,iRow);
43604360
end match;

Compiler/BackEnd/CommonSubExpression.mo

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ algorithm
853853
guard isSkipCase(inExp, functionTree)
854854
then false;
855855

856-
case tsub as DAE.TSUB(exp=call as DAE.CALL(attr=DAE.CALL_ATTR(ty=DAE.T_TUPLE(types=types)), expLst=expLst), ix=ix, ty=ty) algorithm
856+
case tsub as DAE.TSUB(exp=call as DAE.CALL(attr=DAE.CALL_ATTR(ty=DAE.T_TUPLE(types=types))), ix=ix, ty=ty) algorithm
857857
if not BaseHashTable.hasKey(call, HT) then
858858
index := index + 1;
859859
HT := BaseHashTable.add((call, index), HT);
@@ -879,7 +879,7 @@ algorithm
879879
end if;
880880
then true;
881881

882-
case DAE.CALL(attr=DAE.CALL_ATTR(ty=ty), expLst=expLst) algorithm
882+
case DAE.CALL(attr=DAE.CALL_ATTR(ty=ty)) algorithm
883883
if not BaseHashTable.hasKey(inExp, HT) then
884884
index := index + 1;
885885
HT := BaseHashTable.add((inExp, index), HT);
@@ -2239,7 +2239,7 @@ algorithm
22392239
DAE.Type ty;
22402240
DAE.ComponentRef cref;
22412241
list<BackendDAE.Equation> eqLst;
2242-
case({}, _, _, syst as BackendDAE.EQSYSTEM(orderedEqs=_))
2242+
case({}, _, _, syst as BackendDAE.EQSYSTEM())
22432243
equation
22442244
then (BackendDAEUtil.clearEqSyst(syst));
22452245

Compiler/BackEnd/Initialization.mo

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,13 @@ algorithm
533533
then (stmts, inLeftCrs);
534534

535535
// inactive when equation during initialization
536-
case DAE.STMT_WHEN(exp=condition, statementLst=stmts, elseWhen=NONE()) equation
536+
case DAE.STMT_WHEN(exp=_, statementLst=stmts, elseWhen=NONE()) equation
537537
crefLst = CheckModel.algorithmStatementListOutputs(stmts, DAE.EXPAND()); // expand as we're in an algorithm
538538
leftCrs = List.fold(crefLst, BaseHashSet.add, inLeftCrs);
539539
then (inAcc, leftCrs);
540540

541541
// inactive when equation during initialization with elsewhen part
542-
case DAE.STMT_WHEN(exp=condition, statementLst=stmts, elseWhen=SOME(stmt)) equation
542+
case DAE.STMT_WHEN(exp=_, statementLst=stmts, elseWhen=SOME(stmt)) equation
543543
crefLst = CheckModel.algorithmStatementListOutputs(stmts, DAE.EXPAND()); // expand as we're in an algorithm
544544
leftCrs = List.fold(crefLst, BaseHashSet.add, inLeftCrs);
545545
(stmts, leftCrs) = inlineWhenForInitializationWhenStmt(stmt, leftCrs, inAcc);
@@ -1857,7 +1857,7 @@ algorithm
18571857
true = Expression.isZero(exp);
18581858
//listParameter = parameterCheck(exp);
18591859
//true = listEmpty(listParameter);
1860-
eqn = BackendEquation.get(inEqnsOrig, inUnassignedEqn);
1860+
_ = BackendEquation.get(inEqnsOrig, inUnassignedEqn);
18611861
// Error.addCompilerNotification("The following equation is consistent and got removed from the initialization problem: " + BackendDump.equationString(eqn));
18621862
then ({inUnassignedEqn}, true, {});
18631863

@@ -2294,7 +2294,7 @@ algorithm
22942294
isInput = BackendVariable.isVarOnTopLevelAndInput(var);
22952295
preUsed = BaseHashSet.has(cr, hs);
22962296

2297-
crefExp = Expression.crefExp(cr);
2297+
_ = Expression.crefExp(cr);
22982298

22992299
startCR = ComponentReference.crefPrefixStart(cr);
23002300
startVar = BackendVariable.copyVarNewName(startCR, var);
@@ -2340,7 +2340,7 @@ algorithm
23402340
isInput = BackendVariable.isVarOnTopLevelAndInput(var);
23412341
preUsed = BaseHashSet.has(cr, hs);
23422342

2343-
crefExp = Expression.crefExp(cr);
2343+
_ = Expression.crefExp(cr);
23442344

23452345
startCR = ComponentReference.crefPrefixStart(cr);
23462346
startVar = BackendVariable.copyVarNewName(startCR, var);

Compiler/BackEnd/SymbolicImplicitSolver.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ algorithm
273273
cont = false;
274274
then (DAE.BINARY(DAE.BINARY(e1, DAE.SUB(tp), e2), DAE.DIV(tp), e3), (List.unionElt(cr,cr_lst), orderedVars));
275275

276-
case (cr_lst, DAE.CREF(ty=tp, componentRef=cr))
276+
case (cr_lst, DAE.CREF(ty=_, componentRef=cr))
277277
equation
278278
(e, cr_lst) = symSolverAppendStringToStates(cr, cr_lst, orderedVars);
279279
then (e, (cr_lst, orderedVars));

Compiler/BackEnd/SymbolicJacobian.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,7 @@ algorithm
18691869
seedlst = List.map1(comref_vars, createSeedVars, inName);
18701870

18711871
// Differentiate the ODE system w.r.t states for jacobian
1872-
(backendDAE as BackendDAE.DAE(shared=shared), funcs) = generateSymbolicJacobian(reducedDAE, inDiffVars, inDifferentiatedVars, BackendVariable.listVar1(seedlst), inStateVars, inInputVars, inParameterVars, inName);
1872+
(backendDAE as BackendDAE.DAE(shared=_), funcs) = generateSymbolicJacobian(reducedDAE, inDiffVars, inDifferentiatedVars, BackendVariable.listVar1(seedlst), inStateVars, inInputVars, inParameterVars, inName);
18731873
if Flags.isSet(Flags.JAC_DUMP2) then
18741874
print("analytical Jacobians -> generated equations for Jacobian " + inName + " time: " + realString(clock()) + "\n");
18751875
end if;

Compiler/BackEnd/SynchronousFeatures.mo

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ algorithm
822822
algorithm
823823
solver1 := mergeSolver(solver1,solver2);
824824
then BackendDAE.SUBCLOCK(MMath.divRational(f1, f2), MMath.addRational(MMath.multRational(s1, f2), s2), solver1);
825-
case(BackendDAE.SUBCLOCK(f1,s1,solver1),BackendDAE.INFERED_SUBCLOCK())
825+
case(BackendDAE.SUBCLOCK(_,_,_),BackendDAE.INFERED_SUBCLOCK())
826826
then subSeqClock;
827827
else
828828
algorithm
@@ -909,7 +909,7 @@ algorithm
909909
local
910910
MMath.Rational shift;
911911
Option<String> solver;
912-
case(BackendDAE.SUBCLOCK(factor,shift,solver))
912+
case(BackendDAE.SUBCLOCK(factor,_,_))
913913
then factor;
914914
else
915915
then MMath.RAT1;
@@ -926,7 +926,7 @@ algorithm
926926
local
927927
MMath.Rational factor;
928928
Option<String> solver;
929-
case(BackendDAE.SUBCLOCK(factor,shift,solver))
929+
case(BackendDAE.SUBCLOCK(_,shift,_))
930930
then shift;
931931
else
932932
then MMath.RAT1;
@@ -942,7 +942,7 @@ algorithm
942942
solver := match(subClk)
943943
local
944944
MMath.Rational factor,shift;
945-
case(BackendDAE.SUBCLOCK(factor,shift,solver))
945+
case(BackendDAE.SUBCLOCK(_,_,solver))
946946
then solver;
947947
else
948948
then NONE();
@@ -1104,7 +1104,7 @@ algorithm
11041104
case(BackendDAE.EQUATION(exp=DAE.CREF(),scalar=DAE.CLKCONST(clk=DAE.INFERRED_CLOCK())))
11051105
algorithm
11061106
then false;
1107-
case(BackendDAE.EQUATION(exp=DAE.CREF(),scalar=DAE.CLKCONST(clk=clk)))
1107+
case(BackendDAE.EQUATION(exp=DAE.CREF(),scalar=DAE.CLKCONST()))
11081108
algorithm
11091109
then true;
11101110
else
@@ -1256,7 +1256,7 @@ algorithm
12561256
removeEdge(eqIdx,varIdx,m,mT);
12571257
then (clockEqsIn, eqIdx::subClockInterfaceEqIdxsIn, eq::subClockInterfaceEqsIn);
12581258

1259-
case(BackendDAE.EQUATION(scalar=e1, exp=e2))
1259+
case(BackendDAE.EQUATION(scalar=_))
12601260
algorithm
12611261
//print("Thats also not a base clock "+BackendDump.equationString(eq)+"\n");
12621262
then (clockEqsIn, subClockInterfaceEqIdxsIn, subClockInterfaceEqsIn);

Compiler/BackEnd/UnitCheck.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ algorithm
790790
then (Unit.MASTER({}), (HtCr2U, HtS2U, HtU2S), expListList);
791791

792792
//IFEXP
793-
case (DAE.IFEXP(exp1, exp2, exp3), (HtCr2U, HtS2U, HtU2S), _) equation
793+
case (DAE.IFEXP(_, exp2, exp3), (HtCr2U, HtS2U, HtU2S), _) equation
794794
//(_, (HtCr2U, HtS2U, HtU2S), expListList) = insertUnitInEquation(exp1, (HtCr2U, HtS2U, HtU2S), Unit.MASTER({}));
795795
(ut, (HtCr2U, HtS2U, HtU2S), expListList2) = insertUnitInEquation(exp2, (HtCr2U, HtS2U, HtU2S), inUt);
796796
(ut2, (HtCr2U, HtS2U, HtU2S), expListList3) = insertUnitInEquation(exp3, (HtCr2U, HtS2U, HtU2S), ut);
@@ -800,7 +800,7 @@ algorithm
800800
expListList = listAppend(expListList2, expListList3);
801801
then (ut, (HtCr2U, HtS2U, HtU2S), expListList);
802802

803-
case (DAE.IFEXP(exp1, exp2, exp3), (HtCr2U, HtS2U, HtU2S), _) equation
803+
case (DAE.IFEXP(_, exp2, exp3), (HtCr2U, HtS2U, HtU2S), _) equation
804804
//(_, (HtCr2U, HtS2U, HtU2S), expListList) = insertUnitInEquation(exp1, (HtCr2U, HtS2U, HtU2S), Unit.MASTER({}));
805805
(ut, (HtCr2U, HtS2U, HtU2S), expListList2) = insertUnitInEquation(exp2, (HtCr2U, HtS2U, HtU2S), inUt);
806806
(ut2, (HtCr2U, HtS2U, HtU2S), expListList3) = insertUnitInEquation(exp3, (HtCr2U, HtS2U, HtU2S), ut);

Compiler/BackEnd/VisualXML.mo

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -506,15 +506,7 @@ algorithm
506506
end if;
507507
then (SHAPE(ident, shapeType, T, r, r_shape, lengthDir, widthDir, length, width, height, extra, color, exp));
508508

509-
else
510-
algorithm
511-
BackendDAE.VAR(bindExp=bind) := var;
512-
if isSome(bind) then
513-
_ := if not Expression.isConstValue(Util.getOption(bind)) and storeProtectedCrefs then BackendVariable.varExp(var) else Util.getOption(bind);
514-
else _ := DAE.SCONST("NO_BINDING");
515-
end if;
516-
//print("whats this? :"+ComponentReference.printComponentRefStr(cref)+" with binding: "+ExpressionDump.printExpStr(exp)+"\n");
517-
then visIn;
509+
else visIn;
518510
end matchcontinue;
519511
end fillShapeObject;
520512

0 commit comments

Comments
 (0)