Fixed a nasty problem involving mixing the Meta tags while building the flow-graph, and added a comment about it

This commit is contained in:
Neil Brown 2008-02-01 14:34:17 +00:00
parent 30e890ef02
commit cb9aa03612
2 changed files with 8 additions and 6 deletions

View File

@ -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) ->

View File

@ -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