diff --git a/Compiler/BackEnd/BackendDAEUtil.mo b/Compiler/BackEnd/BackendDAEUtil.mo index 81e08179e9d..f8fe8dc88fa 100644 --- a/Compiler/BackEnd/BackendDAEUtil.mo +++ b/Compiler/BackEnd/BackendDAEUtil.mo @@ -9188,7 +9188,7 @@ algorithm eqs := arrayGet(mT, i); var := BackendVariable.getVarAt(varsArray, i); info := var.source.info; - if listLength(eqs) == 0 then + if listEmpty(eqs) then Error.addSourceMessage(Error.VAR_NO_REMAINING_EQN, { ComponentReference.printComponentRefStr(var.varName), stringAppendList(list("\n Equation " + String(eq) + ": " + BackendDump.equationString(BackendEquation.get(eqsArray, eq)) + ", which needs to solve for " + stringDelimitList(list(ComponentReference.printComponentRefStr(Util.tuple21(tpl)) for tpl in arrayGet(solvedEqs, eq)), ", ") for eq in arrayGet(mTOrig, i))) diff --git a/Compiler/BackEnd/Matching.mo b/Compiler/BackEnd/Matching.mo index 93f0f4177fe..d8b7ba4535f 100644 --- a/Compiler/BackEnd/Matching.mo +++ b/Compiler/BackEnd/Matching.mo @@ -249,7 +249,7 @@ protected algorithm for i in 1:nEqns loop vars := m[i]; - while not success and (listLength(vars) > 0) loop + while not success and not listEmpty(vars) loop j::vars := vars; // negative entries in adjacence matrix belong to states!!! if (j>0 and ass1[j] <= 0) then diff --git a/Compiler/BackEnd/SynchronousFeatures.mo b/Compiler/BackEnd/SynchronousFeatures.mo index 1b2e26de43a..9d42118859d 100644 --- a/Compiler/BackEnd/SynchronousFeatures.mo +++ b/Compiler/BackEnd/SynchronousFeatures.mo @@ -93,7 +93,7 @@ protected algorithm (clockedSysts, contSysts) := List.splitOnTrue(inDAE.eqs, BackendDAEUtil.isClockedSyst); - if listLength(clockedSysts) > 0 then + if not listEmpty(clockedSysts) then shared := inDAE.shared; (clockedSysts, shared) := treatClockedStates(clockedSysts, shared); @@ -124,7 +124,7 @@ algorithm (clockedSysts, systs) := List.splitOnTrue(inDAE.eqs, BackendDAEUtil.isClockedSyst); shared := inDAE.shared; - if listLength(systs) > 0 then + if not listEmpty(systs) then BackendDAE.DAE({syst}, shared) := BackendDAEOptimize.collapseIndependentBlocks(BackendDAE.DAE(systs, shared)); (systs, clockedSysts1, unpartRemEqs) := baseClockPartitioning(syst, shared); assert(listLength(clockedSysts1) == 0, "Get clocked system in SynchronousFeatures.addContVarsEqs"); diff --git a/Compiler/BackEnd/Tearing.mo b/Compiler/BackEnd/Tearing.mo index d43cf78f230..dac625b4ae5 100644 --- a/Compiler/BackEnd/Tearing.mo +++ b/Compiler/BackEnd/Tearing.mo @@ -377,8 +377,10 @@ protected function getUserTearingSet output list userResidualsThisComponent={}; protected Integer i=1, start, end_; + Integer len; algorithm - while i < listLength(userTVars) loop + len := listLength(userTVars); + while i < len loop if intEq(listGet(userTVars,i),strongComponentIndex) then start := i+2; end_ := i + 1 + listGet(userTVars, i+1); @@ -394,7 +396,8 @@ algorithm end while; if not listEmpty(userTvarsThisComponent) then i := 1; - while i < listLength(userResiduals) loop + len := listLength(userResiduals); + while i < len loop if intEq(listGet(userResiduals,i),strongComponentIndex) then start := i+2; end_ := i + 1 + listGet(userResiduals, i+1); diff --git a/Compiler/FrontEnd/Types.mo b/Compiler/FrontEnd/Types.mo index 81617db5be5..7a60166dfce 100644 --- a/Compiler/FrontEnd/Types.mo +++ b/Compiler/FrontEnd/Types.mo @@ -427,24 +427,19 @@ algorithm Type at; DAE.Dimensions ad; DAE.Dimension dim; - Integer ll; list vars; ClassInf.State CIS; DAE.EqualityConstraint ec; // convert just the array! - case DAE.T_ARRAY(at,dim::ad) - equation - ll = listLength(ad); - true = (ll == 0); + case DAE.T_ARRAY(at,{dim}) + equation ty = expTypetoTypesType(at); tty = DAE.T_ARRAY(ty,{dim}); then tty; case DAE.T_ARRAY(at,dim::ad) equation - ll = listLength(ad); - true = (ll > 0); ty = expTypetoTypesType(DAE.T_ARRAY(at,ad)); tty = DAE.T_ARRAY(ty,{dim}); then diff --git a/Compiler/SimCode/SimCodeUtil.mo b/Compiler/SimCode/SimCodeUtil.mo index 86cd8fbfd42..e125e00f3cc 100644 --- a/Compiler/SimCode/SimCodeUtil.mo +++ b/Compiler/SimCode/SimCodeUtil.mo @@ -890,7 +890,7 @@ protected function setJacobianVars "author: unknown protected SimCodeVar.SimVars vars; algorithm - if listLength(iJacobianVars) > 0 then + if not listEmpty(iJacobianVars) then vars := oModelInfo.vars; vars.jacobianVars := iJacobianVars; oModelInfo.vars := vars; diff --git a/Compiler/Util/Util.mo b/Compiler/Util/Util.mo index 287977177d5..8592f4a4357 100644 --- a/Compiler/Util/Util.mo +++ b/Compiler/Util/Util.mo @@ -496,7 +496,7 @@ protected algorithm lst:=stringSplitAtChar(inString,delim); lst2:=List.map(lst, stringInt); - if(intGt(listLength(lst2), 0)) then + if not listEmpty(lst2) then i := List.fold(lst2,intMul,1); else i := 0;