@@ -279,8 +279,8 @@ algorithm
279279 list< DAE . Ident > iv;
280280 Option < HashTable2 . HashTable > derConst;
281281 case ((REPLACEMENTS (hashTable= ht)),src,_) /* source dest */
282- equation
283- _ = BaseHashTable . get (src,ht) "if rule a->b exists, fail" ;
282+ guard
283+ BaseHashTable . hasKey (src,ht) "if rule a->b exists, fail"
284284 then
285285 fail();
286286 case ((REPLACEMENTS (ht,invHt,eht,iv,derConst)),src,dst)
@@ -371,26 +371,18 @@ protected function addReplacementInv2 "
371371 input DAE . ComponentRef dst;
372372 input DAE . ComponentRef src;
373373 output HashTable3 . HashTable outInvHt;
374+ protected
375+ list< DAE . ComponentRef > srcs;
374376algorithm
375- outInvHt:=
376- matchcontinue (invHt,dst,src)
377- local
378- HashTable3 . HashTable invHt_1;
379- list< DAE . ComponentRef > srcs;
380- case (_,_,_)
381- equation
382- failure(_ = BaseHashTable . get(dst,invHt)) "No previous elt for dst -> src" ;
383- invHt_1 = BaseHashTable . add((dst, {src}),invHt);
384- then
385- invHt_1;
386- case (_,_,_)
387- equation
388- srcs = BaseHashTable . get(dst,invHt) "previous elt for dst -> src, append.." ;
389- srcs = src::srcs;
390- invHt_1 = BaseHashTable . add((dst, srcs),invHt);
391- then
392- invHt_1;
393- end matchcontinue;
377+ if BaseHashTable . hasKey(dst,invHt) then
378+ // previous elt for dst -> src, append..
379+ srcs := BaseHashTable . get(dst,invHt);
380+ srcs := src::srcs;
381+ outInvHt := BaseHashTable . add((dst, srcs),invHt);
382+ else
383+ // No previous elt for dst -> src
384+ outInvHt:= BaseHashTable . add((dst, {src}),invHt);
385+ end if ;
394386end addReplacementInv2;
395387
396388protected function makeTransitive "
@@ -559,22 +551,22 @@ algorithm
559551 case (_,DAE . CREF_IDENT (ident= ident,identType= ty as DAE . T_ARRAY ()),NONE ())
560552 equation
561553 precr = ComponentReference . makeCrefIdent(ident,ty,{});
562- failure(_ = BaseHashTable . get (precr,extendrepl) );
554+ false = BaseHashTable . hasKey (precr,extendrepl);
563555 // update Replacements
564556 erepl = BaseHashTable . add((precr, DAE . RCONST (0 . 0 )),extendrepl);
565557 then erepl;
566558 case (_,DAE . CREF_IDENT (ident= ident,identType= ty as DAE . T_ARRAY ()),SOME (pcr))
567559 equation
568560 precr = ComponentReference . makeCrefIdent(ident,ty,{});
569561 precr1 = ComponentReference . joinCrefs(pcr,precr);
570- failure(_ = BaseHashTable . get (precr1,extendrepl) );
562+ false = BaseHashTable . hasKey (precr1,extendrepl);
571563 // update Replacements
572564 erepl = BaseHashTable . add((precr1, DAE . RCONST (0 . 0 )),extendrepl);
573565 then erepl;
574566 case (_,DAE . CREF_IDENT (ident= ident,identType= ty as DAE . T_COMPLEX (complexClassType= ClassInf . RECORD (_),varLst= varLst)),NONE ())
575567 equation
576568 precr = ComponentReference . makeCrefIdent(ident,ty,{});
577- failure(_ = BaseHashTable . get (precr,extendrepl) );
569+ false = BaseHashTable . hasKey (precr,extendrepl);
578570 // update Replacements
579571 erepl = BaseHashTable . add((precr, DAE . RCONST (0 . 0 )),extendrepl);
580572 // Create a list of crefs from names
@@ -585,7 +577,7 @@ algorithm
585577 equation
586578 _ = ComponentReference . makeCrefIdent(ident,ty,{});
587579 precr1 = ComponentReference . joinCrefs(pcr,cr);
588- failure(_ = BaseHashTable . get (precr1,extendrepl) );
580+ false = BaseHashTable . hasKey (precr1,extendrepl);
589581 // update Replacements
590582 erepl = BaseHashTable . add((precr1, DAE . RCONST (0 . 0 )),extendrepl);
591583 // Create a list of crefs from names
@@ -595,15 +587,15 @@ algorithm
595587 case (_,DAE . CREF_IDENT (ident= ident,identType= ty,subscriptLst= _::_),NONE ())
596588 equation
597589 precr = ComponentReference . makeCrefIdent(ident,ty,{});
598- failure(_ = BaseHashTable . get (precr,extendrepl) );
590+ false = BaseHashTable . hasKey (precr,extendrepl);
599591 // update Replacements
600592 erepl = BaseHashTable . add((precr, DAE . RCONST (0 . 0 )),extendrepl);
601593 then erepl;
602594 case (_,DAE . CREF_IDENT (ident= ident,identType= ty,subscriptLst= _::_),SOME (pcr))
603595 equation
604596 precr = ComponentReference . makeCrefIdent(ident,ty,{});
605597 precr1 = ComponentReference . joinCrefs(pcr,precr);
606- failure(_ = BaseHashTable . get (precr1,extendrepl) );
598+ false = BaseHashTable . hasKey (precr1,extendrepl);
607599 // update Replacements
608600 erepl = BaseHashTable . add((precr1, DAE . RCONST (0 . 0 )),extendrepl);
609601 then erepl;
@@ -613,7 +605,7 @@ algorithm
613605 case (_,DAE . CREF_QUAL (ident= ident,identType= ty,subscriptLst= subscriptLst,componentRef= subcr),NONE ())
614606 equation
615607 precr = ComponentReference . makeCrefIdent(ident,ty,{});
616- failure(_ = BaseHashTable . get (precr,extendrepl) );
608+ false = BaseHashTable . hasKey (precr,extendrepl);
617609 // update Replacements
618610 erepl = BaseHashTable . add((precr, DAE . RCONST (0 . 0 )),extendrepl);
619611 precrn = ComponentReference . makeCrefIdent(ident,ty,subscriptLst);
@@ -623,7 +615,7 @@ algorithm
623615 equation
624616 precr = ComponentReference . makeCrefIdent(ident,ty,{});
625617 precr1 = ComponentReference . joinCrefs(pcr,precr);
626- failure(_ = BaseHashTable . get (precr1,extendrepl) );
618+ false = BaseHashTable . hasKey (precr1,extendrepl);
627619 // update Replacements
628620 erepl = BaseHashTable . add((precr1, DAE . RCONST (0 . 0 )),extendrepl);
629621 precrn = ComponentReference . makeCrefIdent(ident,ty,subscriptLst);
@@ -793,18 +785,17 @@ public function hasReplacement "
793785 output Boolean bOut;
794786algorithm
795787 bOut:=
796- matchcontinue (inVariableReplacements,inComponentRef)
788+ match (inVariableReplacements,inComponentRef)
797789 local
798790 DAE . ComponentRef src;
799791 DAE . Exp dst;
800792 HashTable2 . HashTable ht;
801793 case (REPLACEMENTS (hashTable= ht),src)
802- equation
803- _ = BaseHashTable . get(src,ht);
794+ guard BaseHashTable . hasKey(src,ht)
804795 then
805796 true ;
806797 else false ;
807- end matchcontinue ;
798+ end match ;
808799end hasReplacement;
809800
810801public function hasReplacementCrefFirst "
@@ -815,18 +806,17 @@ public function hasReplacementCrefFirst "
815806 output Boolean bOut;
816807algorithm
817808 bOut:=
818- matchcontinue (inComponentRef,inVariableReplacements)
809+ match (inComponentRef,inVariableReplacements)
819810 local
820811 DAE . ComponentRef src;
821812 DAE . Exp dst;
822813 HashTable2 . HashTable ht;
823814 case (src,REPLACEMENTS (hashTable= ht))
824- equation
825- _ = BaseHashTable . get(src,ht);
815+ guard BaseHashTable . hasKey(src,ht)
826816 then
827817 true ;
828818 else false ;
829- end matchcontinue ;
819+ end match ;
830820end hasReplacementCrefFirst;
831821
832822public function hasNoReplacementCrefFirst "
@@ -837,18 +827,17 @@ public function hasNoReplacementCrefFirst "
837827 output Boolean bOut;
838828algorithm
839829 bOut:=
840- matchcontinue (inComponentRef,inVariableReplacements)
830+ match (inComponentRef,inVariableReplacements)
841831 local
842832 DAE . ComponentRef src;
843833 DAE . Exp dst;
844834 HashTable2 . HashTable ht;
845835 case (src,REPLACEMENTS (hashTable= ht))
846- equation
847- _ = BaseHashTable . get(src,ht);
836+ guard BaseHashTable . hasKey(src,ht)
848837 then
849838 false ;
850839 else true ;
851- end matchcontinue ;
840+ end match ;
852841end hasNoReplacementCrefFirst;
853842
854843public function varHasNoReplacement "
@@ -859,18 +848,17 @@ public function varHasNoReplacement "
859848 output Boolean bOut;
860849algorithm
861850 bOut:=
862- matchcontinue (var ,inVariableReplacements)
851+ match (var ,inVariableReplacements)
863852 local
864853 DAE . ComponentRef src;
865854 DAE . Exp dst;
866855 HashTable2 . HashTable ht;
867856 case (BackendDAE . VAR (varName= src),REPLACEMENTS (hashTable= ht))
868- equation
869- _ = BaseHashTable . get(src,ht);
857+ guard BaseHashTable . hasKey(src,ht)
870858 then
871859 false ;
872860 else true ;
873- end matchcontinue ;
861+ end match ;
874862end varHasNoReplacement;
875863
876864public function getReplacementVarArraySize
0 commit comments