From cb9aa03612aa74bf403cae53f20e7fe290d37bed Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 1 Feb 2008 14:34:17 +0000 Subject: [PATCH] Fixed a nasty problem involving mixing the Meta tags while building the flow-graph, and added a comment about it --- common/FlowGraph.hs | 6 ++++-- common/FlowGraphTest.hs | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/common/FlowGraph.hs b/common/FlowGraph.hs index 2f9360a..035dc6f 100644 --- a/common/FlowGraph.hs +++ b/common/FlowGraph.hs @@ -199,7 +199,9 @@ buildFlowGraph funcs s if (notElem start $ map fst nodes) || (notElem end $ map fst nodes) then throwError "Could not add edge between non-existent nodes" else put (n + 1, pi, (nodes,(start, end, label):edges), rs) - + + -- It is important for the flow-graph tests that the Meta tag passed in is the same as the + -- result of calling findMeta on the third parameter addNode' :: Meta -> (GraphLabelFuncs mLabel label -> (b -> mLabel label)) -> b -> AlterAST mAlter -> GraphMaker mLabel mAlter label Node addNode' m f t r = do val <- (lift . lift) (run f t) addNode (m, val, r) @@ -350,7 +352,7 @@ buildFlowGraph funcs s buildStructured outer (A.Rep m rep str) route = do let alter = AlterReplicator $ route23 route A.Rep case outer of - OSeq -> do n <- addNode' m labelReplicator rep alter + OSeq -> do n <- addNode' (findMeta rep) labelReplicator rep alter nodes <- buildStructured outer str (route33 route A.Rep) case nodes of Right (s,e) -> diff --git a/common/FlowGraphTest.hs b/common/FlowGraphTest.hs index 7ab06cd..5352601 100644 --- a/common/FlowGraphTest.hs +++ b/common/FlowGraphTest.hs @@ -181,19 +181,19 @@ testSeq = TestLabel "testSeq" $ TestList -- Replicated SEQ: ,testSeq' 100 [(0,m10), (1,m3), (2,m5)] [(0,1,ESeq), (1,2,ESeq), (2,0,ESeq)] - (A.Rep m10 (A.For mU undefined undefined undefined) $ A.Several m1 [A.OnlyP m2 sm3,A.OnlyP m4 sm5]) + (A.Rep m10 (A.For m10 undefined undefined undefined) $ A.Several m1 [A.OnlyP m2 sm3,A.OnlyP m4 sm5]) ,testSeq'' 101 [(0,m8), (1,m3), (2,m5),(3,m9),(4,m11)] [3] [(3,0,ESeq),(0,1,ESeq), (1,2,ESeq), (2,0,ESeq),(0,4,ESeq)] (A.OnlyP mU $ A.Seq m6 $ A.Several m7 [A.OnlyP mU sm9 - ,(A.Rep m8 (A.For mU undefined undefined undefined) $ A.Several m1 [A.OnlyP m2 sm3,A.OnlyP m4 sm5]) + ,(A.Rep m8 (A.For m8 undefined undefined undefined) $ A.Several m1 [A.OnlyP m2 sm3,A.OnlyP m4 sm5]) ,A.OnlyP mU sm11]) ,testSeq' 102 [(0,m10)] [(0,0,ESeq)] - (A.Rep m10 (A.For mU undefined undefined undefined) $ A.Several mU []) + (A.Rep m10 (A.For m10 undefined undefined undefined) $ A.Several mU []) ,testSeq' 103 [(1,m10), (0,m1), (2,m2)] [(0,1,ESeq),(1,1,ESeq),(1,2,ESeq)] - (A.Several mU [A.OnlyP mU sm1, (A.Rep m10 (A.For mU undefined undefined undefined) $ A.Several mU []), A.OnlyP mU sm2]) + (A.Several mU [A.OnlyP mU sm1, (A.Rep m10 (A.For m10 undefined undefined undefined) $ A.Several mU []), A.OnlyP mU sm2]) ] where