Fixed implicit mobility to work in the (C++, at least) backend

This commit is contained in:
Neil Brown 2008-06-01 19:46:32 +00:00
parent 5301b83148
commit 4e6b166696
3 changed files with 13 additions and 4 deletions

View File

@ -1506,6 +1506,7 @@ cgenAssign m [v] (A.ExpressionList _ [e])
A.Chan A.DirInput _ _ -> doAssign v e
A.Chan A.DirOutput _ _ -> doAssign v e
A.List _ -> call genListAssign v e
A.Mobile (A.List _) -> call genListAssign v e
_ -> call genMissingC $ formatCode "assignment of type %" t
where
doAssign :: A.Variable -> A.Expression -> CGen ()

View File

@ -278,8 +278,8 @@ instance ShowRain A.Type where
ao :: Bool -> String
ao b = if b then "any" else "one"
showRainM A.Time = tell ["time"]
-- Mobility is not explicit in Rain:
showRainM (A.Mobile t) = showRainM t
-- Mobility is not explicit in Rain, but we should indicate it:
showRainM (A.Mobile t) = tell ["<mobile>"] >> showRainM t
showRainM (A.List t) = tell ["["] >> showRainM t >> tell ["]"]
showRainM (A.UnknownVarType en)
= do tell ["(inferred type for: "]
@ -431,7 +431,6 @@ instance ShowRain A.Expression where
showRainM (A.ExprConstr _ (A.RepConstr _ _ r e))
= tell ["["] >> showRainM e >> tell ["|"] >> showRainM r >> tell ["]"]
instance ShowOccam A.Formal where
showOccamM (A.Formal am t n) = (maybeVal am)
>> (showOccamM t)

View File

@ -359,12 +359,21 @@ public:
: ref(_ref)
{
}
/*
//If you dereference both sides, you get a proper copy-assignment:
inline void operator=(const derefTockList& _rhs)
{
ref->data = _rhs.ref->data;
}
*/
inline operator tockList<T>()
{
tockList<T> x;
x.data = ref->data;
return x;
}
};
derefTockList operator*()