Skip to content

Commit

Permalink
some code cleanup:
Browse files Browse the repository at this point in the history
match ... else then ... -> match ... else ...
case  (exp as ...) ...exp... -> case (...) ...inExp...


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23909 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Henning Kiel committed Dec 26, 2014
1 parent 4da0c1d commit e6c0107
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -2715,7 +2715,7 @@ algorithm
then
listAppend(eqns,inEqns);

else then BackendDAE.IF_EQUATION(conditions,theneqns,elseenqs,source,inEqAttr)::inEqns;
else BackendDAE.IF_EQUATION(conditions,theneqns,elseenqs,source,inEqAttr)::inEqns;
end matchcontinue;
end simplifyIfEquation1;

Expand Down
8 changes: 4 additions & 4 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -8044,7 +8044,7 @@ algorithm
isWhen := match(comp)
case(BackendDAE.SINGLEWHENEQUATION())
then true;
else then false;
else false;
end match;
end isWhenComp;

Expand All @@ -8055,7 +8055,7 @@ algorithm
isWhen := match(comp)
case(BackendDAE.SINGLEEQUATION())
then true;
else then false;
else false;
end match;
end isSingleEquationComp;

Expand All @@ -8066,7 +8066,7 @@ algorithm
isWhen := match(comp)
case(BackendDAE.EQUATIONSYSTEM(jacType = BackendDAE.JAC_LINEAR()))
then true;
else then false;
else false;
end match;
end isLinearEqSystemComp;

Expand All @@ -8077,7 +8077,7 @@ algorithm
isWhen := match(comp)
case(BackendDAE.TORNSYSTEM(linear=true))
then true;
else then false;
else false;
end match;
end isLinearTornSystem;

Expand Down
8 changes: 4 additions & 4 deletions Compiler/BackEnd/BackendVariable.mo
Expand Up @@ -1380,7 +1380,7 @@ algorithm

case (BackendDAE.VAR(comment= SOME(comm) ))
then SCode.commentHasBooleanNamedAnnotation(comm, "isMayer");
else then false;
else false;
end match;
end hasMayerTermAnno;

Expand All @@ -1395,7 +1395,7 @@ algorithm

case (BackendDAE.VAR(comment= SOME(comm) ))
then SCode.commentHasBooleanNamedAnnotation(comm, "isLagrange");
else then false;
else false;
end match;
end hasLagrangeTermAnno;

Expand All @@ -1410,7 +1410,7 @@ algorithm

case (BackendDAE.VAR(comment= SOME(comm) ))
then SCode.commentHasBooleanNamedAnnotation(comm, "isConstraint");
else then false;
else false;
end match;
end hasConTermAnno;

Expand All @@ -1425,7 +1425,7 @@ algorithm

case (BackendDAE.VAR(comment= SOME(comm) ))
then SCode.commentHasBooleanNamedAnnotation(comm, "isFinalConstraint");
else then false;
else false;
end match;
end hasFinalConTermAnno;

Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackEnd/ExpressionSolve.mo
Expand Up @@ -1230,7 +1230,7 @@ algorithm
(x, y, new_x, eqnForNewVars, newVarsCrefs, odepth) := match(uniqueEqIndex)
local Integer i;
case(SOME(i)) then preprocessingSolveTmpVarsWork(inExp1, inExp2, inExp3, i, ieqnForNewVars, inewVarsCrefs, idepth);
else then (inExp1, inExp2, false, ieqnForNewVars, inewVarsCrefs, idepth);
else (inExp1, inExp2, false, ieqnForNewVars, inewVarsCrefs, idepth);
end match;
end preprocessingSolveTmpVars;

Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackEnd/StateMachineFeatures.mo
Expand Up @@ -320,7 +320,7 @@ algorithm
transition = if (name == "transition") then (cref, TRANSITION()) else (cref, INITIAL_STATE());
then
SOME(transition);
else then NONE();
else NONE();
end match;


Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackEnd/UnitCheck.mo
Expand Up @@ -617,7 +617,7 @@ algorithm
end if;
then ();

else then ();
else ();
end matchcontinue;
end notification;

Expand Down
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/ConnectionGraph.mo
Expand Up @@ -948,7 +948,7 @@ algorithm
equation
crefs = matchcontinue()
case () then BaseHashTable.get(cref1,itable);
else then {};
else {};
end matchcontinue;
table = BaseHashTable.add((cref1,cref2::crefs),itable);
then
Expand Down
4 changes: 2 additions & 2 deletions Compiler/FrontEnd/Expression.mo
Expand Up @@ -11828,7 +11828,7 @@ algorithm
case("log10") then true;
case("tanh") then true;
case("sinh") then true;
else then false;
else false;
end match;
end createResidualExp4;

Expand All @@ -11839,7 +11839,7 @@ algorithm
isAsub := match(expIn)
case(DAE.ASUB(_,_)) equation
then true;
else then false;
else false;
end match;
end isAsubExp;

Expand Down
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/InstBinding.mo
Expand Up @@ -229,7 +229,7 @@ algorithm
mod2 = Mod.lookupIdxModification(mod, index);
result = instBinding2(mod2, etype, res, bind_name,useConstValue);
then result;
else then NONE();
else NONE();
end matchcontinue;
then
result;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/InstSection.mo
Expand Up @@ -6079,7 +6079,7 @@ algorithm
{Absyn.CREF(componentRef = cref1)}
))))
then {cref1};
else then {};
else {};
end match;
end extractSMStates;

Expand Down
2 changes: 1 addition & 1 deletion Compiler/Script/GlobalScriptUtil.mo
Expand Up @@ -557,7 +557,7 @@ algorithm

case Absyn.ELEMENTITEM(Absyn.ELEMENT(specification=Absyn.CLASSDEF())) :: _ then true;
case _ :: elts then eltsHasLocalClass(elts);
else then false;
else false;
end matchcontinue;
end eltsHasLocalClass;

Expand Down
2 changes: 1 addition & 1 deletion Compiler/SimCode/SimCodeUtil.mo
Expand Up @@ -13907,7 +13907,7 @@ algorithm
then SOME(matrix);
case ( _::rest, _)
then getJacobianMatrix(rest, inJacobianName);
else then NONE();
else NONE();
end matchcontinue;
end getJacobianMatrix;

Expand Down
64 changes: 32 additions & 32 deletions Compiler/Util/VarTransform.mo
Expand Up @@ -1428,38 +1428,38 @@ algorithm
// Note: Most of these functions check if a subexpression did a replacement.
// If it did not, we do not create a new copy of the expression (to save some memory).

case ((e as DAE.CREF(componentRef = cr,ty = t)),repl,cond)
case ((DAE.CREF(componentRef = cr,ty = t)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
e1 = getReplacement(repl, cr);
e2 = avoidDoubleHashLookup(e1,t);
then
(e2,true);
case ((e as DAE.BINARY(exp1 = e1,operator = op,exp2 = e2)),repl,cond)
case ((DAE.BINARY(exp1 = e1,operator = op,exp2 = e2)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(e1_1,c1) = replaceExp(e1, repl, cond);
(e2_1,c2) = replaceExp(e2, repl, cond);
true = c1 or c2;
then
(DAE.BINARY(e1_1,op,e2_1),true);
case ((e as DAE.LBINARY(exp1 = e1,operator = op,exp2 = e2)),repl,cond)
case ((DAE.LBINARY(exp1 = e1,operator = op,exp2 = e2)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(e1_1,c1) = replaceExp(e1, repl, cond);
(e2_1,c2) = replaceExp(e2, repl, cond);
true = c1 or c2;
then
(DAE.LBINARY(e1_1,op,e2_1),true);
case ((e as DAE.UNARY(operator = op,exp = e1)),repl,cond)
case ((DAE.UNARY(operator = op,exp = e1)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(e1_1,true) = replaceExp(e1, repl, cond);
then
(DAE.UNARY(op,e1_1),true);
case ((e as DAE.LUNARY(operator = op,exp = e1)),repl,cond)
case ((DAE.LUNARY(operator = op,exp = e1)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(e1_1,true) = replaceExp(e1, repl, cond);
then
(DAE.LUNARY(op,e1_1),true);
Expand All @@ -1470,9 +1470,9 @@ algorithm
true = c1 or c2;
then
(DAE.RELATION(e1_1,op,e2_1,index_,isExpisASUB),true);
case ((e as DAE.IFEXP(expCond = e1,expThen = e2,expElse = e3)),repl,cond)
case ((DAE.IFEXP(expCond = e1,expThen = e2,expElse = e3)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(e1_1,c1) = replaceExp(e1, repl, cond);
(e2_1,c2) = replaceExp(e2, repl, cond);
(e3_1,c3) = replaceExp(e3, repl, cond);
Expand All @@ -1492,64 +1492,64 @@ algorithm
(expl_1,true) = replaceExpList(expl, repl, cond, {}, false);
then
(DAE.CALL(path,expl_1,attr),true);
case ((e as DAE.ARRAY(ty = tp,scalar = c,array = expl)),repl,cond)
case ((DAE.ARRAY(ty = tp,scalar = c,array = expl)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(expl_1,true) = replaceExpList(expl, repl, cond, {}, false);
then
(DAE.ARRAY(tp,c,expl_1),true);
case ((e as DAE.MATRIX(ty = t,integer = b,matrix = bexpl)),repl,cond)
case ((DAE.MATRIX(ty = t,integer = b,matrix = bexpl)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(bexpl_1,true) = replaceExpMatrix(bexpl, repl, cond, {}, false);
then
(DAE.MATRIX(t,b,bexpl_1),true);
case ((e as DAE.RANGE(ty = tp,start = e1,step = NONE(),stop = e2)),repl,cond)
case ((DAE.RANGE(ty = tp,start = e1,step = NONE(),stop = e2)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(e1_1,c1) = replaceExp(e1, repl, cond);
(e2_1,c2) = replaceExp(e2, repl, cond);
true = c1 or c2;
then
(DAE.RANGE(tp,e1_1,NONE(),e2_1),true);
case ((e as DAE.RANGE(ty = tp,start = e1,step = SOME(e3),stop = e2)),repl,cond)
case ((DAE.RANGE(ty = tp,start = e1,step = SOME(e3),stop = e2)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(e1_1,c1) = replaceExp(e1, repl, cond);
(e2_1,c2) = replaceExp(e2, repl, cond);
(e3_1,c3) = replaceExp(e3, repl, cond);
true = c1 or c2 or c3;
then
(DAE.RANGE(tp,e1_1,SOME(e3_1),e2_1),true);
case ((e as DAE.TUPLE(PR = expl)),repl,cond)
case ((DAE.TUPLE(PR = expl)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(expl_1,true) = replaceExpList(expl, repl, cond, {}, false);
then
(DAE.TUPLE(expl_1),true);
case ((e as DAE.CAST(ty = tp,exp = e1)),repl,cond)
case ((DAE.CAST(ty = tp,exp = e1)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(e1_1,true) = replaceExp(e1, repl, cond);
then
(DAE.CAST(tp,e1_1),true);
case ((e as DAE.ASUB(exp = e1,sub = expl)),repl,cond)
case ((DAE.ASUB(exp = e1,sub = expl)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(e1_1,c1) = replaceExp(e1, repl, cond);
(expl_1,c2) = replaceExpList(expl, repl, cond, {}, false);
true = c1 or c2;
then
(Expression.makeASUB(e1_1,expl_1),true);
case ((e as DAE.SIZE(exp = e1,sz = NONE())),repl,cond)
case ((DAE.SIZE(exp = e1,sz = NONE())),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(e1_1,true) = replaceExp(e1, repl, cond);
then
(DAE.SIZE(e1_1,NONE()),true);
case ((e as DAE.SIZE(exp = e1,sz = SOME(e2))),repl,cond)
case ((DAE.SIZE(exp = e1,sz = SOME(e2))),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(e1_1,c1) = replaceExp(e1, repl, cond);
(e2_1,c2) = replaceExp(e2, repl, cond);
true = c1 or c2;
Expand All @@ -1560,9 +1560,9 @@ algorithm
print("replace_exp on CODE not impl.\n");
then
(DAE.CODE(a,tp),false);
case ((e as DAE.REDUCTION(reductionInfo = reductionInfo,expr = e1,iterators = iters)),repl,cond)
case ((DAE.REDUCTION(reductionInfo = reductionInfo,expr = e1,iterators = iters)),repl,cond)
equation
true = replaceExpCond(cond, e);
true = replaceExpCond(cond, inExp);
(e1_1,_) = replaceExp(e1, repl, cond);
(iters,true) = replaceExpIters(iters, repl, cond, {}, false);
then (DAE.REDUCTION(reductionInfo,e1_1,iters),true);
Expand Down

0 comments on commit e6c0107

Please sign in to comment.