diff --git a/Compiler/BackEnd/BackendDAECreate.mo b/Compiler/BackEnd/BackendDAECreate.mo index dd23ed1d5fb..78a10a06259 100644 --- a/Compiler/BackEnd/BackendDAECreate.mo +++ b/Compiler/BackEnd/BackendDAECreate.mo @@ -2339,38 +2339,33 @@ algorithm case ({}, _, _) then iHt; - case (DAE.EQUEQUATION(cr1=cr, cr2=cr2, source=source)::rest, _, _) + case (DAE.EQUEQUATION(cr1=cr, cr2=cr2, source=source)::rest, _, _) guard not BaseHashTable.hasKey(cr, iHt) equation - failure( _ = BaseHashTable.get(cr, iHt)); e = Expression.crefExp(cr2); false = Expression.expHasCrefNoPreorDer(e, cr); ht = BaseHashTable.add((cr, (e, source)), iHt); then lowerWhenIfEqnsElse(rest, functionTree, ht); - case (DAE.DEFINE(componentRef=cr, exp=e, source=source)::rest, _, _) + case (DAE.DEFINE(componentRef=cr, exp=e, source=source)::rest, _, _) guard not BaseHashTable.hasKey(cr, iHt) equation - failure( _ = BaseHashTable.get(cr, iHt)); false = Expression.expHasCrefNoPreorDer(e, cr); ht = BaseHashTable.add((cr, (e, source)), iHt); then lowerWhenIfEqnsElse(rest, functionTree, ht); - case (DAE.EQUATION(exp=DAE.CREF(componentRef=cr), scalar=e, source=source)::rest, _, _) + case (DAE.EQUATION(exp=DAE.CREF(componentRef=cr), scalar=e, source=source)::rest, _, _) guard not BaseHashTable.hasKey(cr, iHt) equation - failure( _ = BaseHashTable.get(cr, iHt)); false = Expression.expHasCrefNoPreorDer(e, cr); ht = BaseHashTable.add((cr, (e, source)), iHt); then lowerWhenIfEqnsElse(rest, functionTree, ht); - case (DAE.COMPLEX_EQUATION(lhs=DAE.CREF(componentRef=cr), rhs=e, source=source)::rest, _, _) + case (DAE.COMPLEX_EQUATION(lhs=DAE.CREF(componentRef=cr), rhs=e, source=source)::rest, _, _) guard not BaseHashTable.hasKey(cr, iHt) equation - failure( _ = BaseHashTable.get(cr, iHt)); false = Expression.expHasCrefNoPreorDer(e, cr); ht = BaseHashTable.add((cr, (e, source)), iHt); then lowerWhenIfEqnsElse(rest, functionTree, ht); - case (DAE.ARRAY_EQUATION(exp=DAE.CREF(componentRef=cr), array=e, source=source)::rest, _, _) + case (DAE.ARRAY_EQUATION(exp=DAE.CREF(componentRef=cr), array=e, source=source)::rest, _, _) guard not BaseHashTable.hasKey(cr, iHt) equation - failure( _ = BaseHashTable.get(cr, iHt)); false = Expression.expHasCrefNoPreorDer(e, cr); ht = BaseHashTable.add((cr, (e, source)), iHt); then diff --git a/Compiler/BackEnd/BackendDAEOptimize.mo b/Compiler/BackEnd/BackendDAEOptimize.mo index d8017d49cbe..5458ec26c32 100644 --- a/Compiler/BackEnd/BackendDAEOptimize.mo +++ b/Compiler/BackEnd/BackendDAEOptimize.mo @@ -2394,16 +2394,14 @@ algorithm case ({},_) then iHt; - case (BackendDAE.EQUATION(exp=DAE.CREF(componentRef=cr), scalar=e)::rest,_) + case (BackendDAE.EQUATION(exp=DAE.CREF(componentRef=cr), scalar=e)::rest,_) guard not BaseHashTable.hasKey(cr, iHt) equation - failure( _ = BaseHashTable.get(cr, iHt)); false = Expression.expHasCref(e, cr); ht = BaseHashTable.add((cr,e), iHt); then simplifySolvedIfEqnsElse(rest,ht); - case (BackendDAE.EQUATION(exp=DAE.UNARY(operator=DAE.UMINUS(), exp=DAE.CREF(componentRef=cr)), scalar=e)::rest,_) + case (BackendDAE.EQUATION(exp=DAE.UNARY(operator=DAE.UMINUS(), exp=DAE.CREF(componentRef=cr)), scalar=e)::rest,_) guard not BaseHashTable.hasKey(cr, iHt) equation - failure( _ = BaseHashTable.get(cr, iHt)); false = Expression.expHasCref(e, cr); e = Expression.negate(e); ht = BaseHashTable.add((cr,e), iHt); @@ -2986,16 +2984,7 @@ protected function semiLinearGetSA input list iAcc; output list oAcc; algorithm - oAcc := matchcontinue(key,iHt1,iAcc) - case (_,_,_) - equation - _ = BaseHashTable.get(key,iHt1); - then - iAcc; - case(_,_,_) - then - key::iAcc; - end matchcontinue; + oAcc := if BaseHashTable.hasKey(key, iHt1) then iAcc else key::iAcc; end semiLinearGetSA; protected function semiLinearOptimize1 diff --git a/Compiler/BackEnd/BackendEquation.mo b/Compiler/BackEnd/BackendEquation.mo index 1e74bb044ff..2a3b90dd6d0 100644 --- a/Compiler/BackEnd/BackendEquation.mo +++ b/Compiler/BackEnd/BackendEquation.mo @@ -640,9 +640,7 @@ algorithm then (inExp, inTuple); // already there - case (DAE.CREF(componentRef = cr), (_, _, ht)) - equation - _ = BaseHashTable.get(cr, ht); + case (DAE.CREF(componentRef = cr), (_, _, ht)) guard BaseHashTable.hasKey(cr, ht) then (inExp, inTuple); // known diff --git a/Compiler/FrontEnd/Lookup.mo b/Compiler/FrontEnd/Lookup.mo index b893f7445bf..5b1d5dc936a 100644 --- a/Compiler/FrontEnd/Lookup.mo +++ b/Compiler/FrontEnd/Lookup.mo @@ -417,7 +417,7 @@ starts to traverse." output HashTableStringToPath.HashTable outHt; output list outMetarecordTypes; algorithm - (outCache,outHt,outMetarecordTypes) := matchcontinue (inCache, inEnv, path, str, inHt, inAcc) + (outCache,outHt,outMetarecordTypes) := match (inCache, inEnv, path, str, inHt, inAcc) local FCore.Cache cache; FCore.Graph env; @@ -427,9 +427,7 @@ algorithm list acc; HashTableStringToPath.HashTable ht; - case (cache, _, _, _, ht, acc) - equation - _ = BaseHashTable.get(str, ht); + case (cache, _, _, _, ht, acc) guard BaseHashTable.hasKey(str, ht) then (cache, ht, acc); case (cache, env, _, _, ht, acc) equation @@ -440,7 +438,7 @@ algorithm uniontypePaths = List.flatten(List.map(uniontypeTypes, Types.getUniontypePaths)); (cache, ht, acc) = lookupMetarecordsRecursive2(cache, env, uniontypePaths, ht, acc); then (cache,ht,acc); - end matchcontinue; + end match; end lookupMetarecordsRecursive3; public function lookupClass "Tries to find a specified class in an environment"