@@ -65,6 +65,7 @@ import ElementSource;
6565import Expression ;
6666import ExpressionDump ;
6767import Error ;
68+ import ErrorExt ;
6869import Flags ;
6970import FGraph ;
7071import Inst ;
@@ -1284,7 +1285,7 @@ protected function checkDefUsePattern
12841285 output DAE . Pattern outPat;
12851286 output tuple< AvlSetString . Tree ,AvlSetString . Tree ,SourceInfo > outTpl= inTpl;
12861287algorithm
1287- outPat := matchcontinue (inPat,inTpl)
1288+ outPat := match (inPat,inTpl)
12881289 local
12891290 AvlSetString . Tree localsTree,useTree;
12901291 String name;
@@ -1294,7 +1295,6 @@ algorithm
12941295 tuple< AvlSetString . Tree ,AvlSetString . Tree ,SourceInfo > extra;
12951296 case ((DAE . PAT_AS (id= name,pat= pat),extra as (localsTree,useTree,info)))
12961297 equation
1297- // TODO: Can skip matchcontinue and failure if there was an AvlTree.exists(key)
12981298 if AvlSetString . hasKey(localsTree,name) and not AvlSetString . hasKey(useTree,name) then
12991299 Error . assertionOrAddSourceMessage(not Flags . isSet(Flags . PATTERNM_ALL_INFO ),Error . META_UNUSED_AS_BINDING ,{name},info);
13001300 else
@@ -1303,7 +1303,6 @@ algorithm
13031303 then pat;
13041304 case ((DAE . PAT_AS_FUNC_PTR (id= name,pat= pat),extra as (localsTree,useTree,info)))
13051305 equation
1306- // TODO: Can skip matchcontinue and failure if there was an AvlTree.exists(key)
13071306 if AvlSetString . hasKey(localsTree,name) and not AvlSetString . hasKey(useTree,name) then
13081307 Error . assertionOrAddSourceMessage(not Flags . isSet(Flags . PATTERNM_ALL_INFO ),Error . META_UNUSED_AS_BINDING ,{name},info);
13091308 else
@@ -1314,7 +1313,7 @@ algorithm
13141313 algorithm
13151314 (pat,_) := simplifyPattern(inPat,1 );
13161315 then pat;
1317- end matchcontinue ;
1316+ end match ;
13181317end checkDefUsePattern;
13191318
13201319protected function useLocalCref
@@ -2959,7 +2958,9 @@ algorithm
29592958 case DAE . STMT_FOR (ty,b,id,index,exp,body,source)
29602959 equation
29612960 // Loops repeat, so check for usage in the whole loop before removing any dead stores.
2961+ ErrorExt . setCheckpoint(getInstanceName());
29622962 (_, useTree) = List . map1Fold(body, statementFindDeadStore, localsTree, inUseTree);
2963+ ErrorExt . rollBack(getInstanceName());
29632964 (body,useTree) = statementListFindDeadStoreRemoveEmptyStatements(body,localsTree, useTree);
29642965 (_,useTree) = Expression . traverseExpBottomUp(exp, useLocalCref, useTree);
29652966 // TODO: We should remove ident from the use-tree in case of shadowing... But our avlTree cannot delete
@@ -2969,7 +2970,9 @@ algorithm
29692970 case DAE . STMT_WHILE (exp= exp,statementLst= body,source= source)
29702971 equation
29712972 // Loops repeat, so check for usage in the whole loop before removing any dead stores.
2973+ ErrorExt . setCheckpoint(getInstanceName());
29722974 (_, useTree) = List . map1Fold(body, statementFindDeadStore, localsTree, inUseTree);
2975+ ErrorExt . rollBack(getInstanceName());
29732976 (body,useTree) = statementListFindDeadStoreRemoveEmptyStatements(body, localsTree, useTree);
29742977 (_,useTree) = Expression . traverseExpBottomUp(exp, useLocalCref, useTree);
29752978 // The loop might not be entered just like if. The following should not remove all previous uses:
0 commit comments