Fixed the generation of directed channels for the C++ backend

This commit is contained in:
Neil Brown 2009-04-08 19:14:29 +00:00
parent de097bb138
commit debdef4f4f
2 changed files with 4 additions and 3 deletions

View File

@ -709,11 +709,12 @@ cgenVariableWithAM checkValid v am fct
, Pointer $ innerCT)
_ -> inner v
inner wholeV@(A.DirectedVariable m dir v)
= do (cg, _) <- inner v
= do (cg, ctInner) <- inner v
let cg' = dressUp m (cg, ctInner) (stripPointers ctInner)
t <- astTypeOf v
wholeT <- astTypeOf wholeV
ct <- call getCType m wholeT A.Original
return (call genDirectedVariable m t cg dir, ct)
return (call genDirectedVariable m t cg' dir, ct)
inner (A.VariableSizes m (A.Variable _ n))
= do t <- astTypeOf n
f <- fget getScalarType

View File

@ -886,7 +886,7 @@ cppgenDirectedVariable :: Meta -> A.Type -> CGen () -> A.Direction -> CGen ()
cppgenDirectedVariable m t v dir
= case t of
A.ChanEnd {} -> v
A.Chan {} -> tell ["(("] >> v >> tell [")->",if dir == A.DirInput
A.Chan {} -> tell ["(("] >> v >> tell [").",if dir == A.DirInput
then "reader" else "writer","())"]
A.Array _ (A.ChanEnd {}) -> v
A.Array _ (A.Chan {}) -> dieP m "Should have pulled up directed arrays"