diff --git a/Compiler/Util/BaseHashSet.mo b/Compiler/Util/BaseHashSet.mo index d7ad343a47f..7b1355d0ca5 100644 --- a/Compiler/Util/BaseHashSet.mo +++ b/Compiler/Util/BaseHashSet.mo @@ -350,26 +350,16 @@ protected function get2 input list> keyIndices; input FuncEq keyEqual; output Integer index; +protected + Key key2; algorithm - index := matchcontinue (key,keyIndices,keyEqual) - local - Key key2; - list> xs; - - // search for the key, found the good one - case (_,((key2,index) :: _),_) - equation - true = keyEqual(key, key2); - then - index; - - // search more - case (_,(_ :: xs),_) - equation - index = get2(key, xs, keyEqual); - then - index; - end matchcontinue; + for t in keyIndices loop + (key2,index) := t; + if keyEqual(key, key2) then + return; + end if; + end for; + fail(); end get2; public function printHashSet ""