diff --git a/frontends/ParseOccam.hs b/frontends/ParseOccam.hs index 325de96..e61d43f 100644 --- a/frontends/ParseOccam.hs +++ b/frontends/ParseOccam.hs @@ -1415,13 +1415,13 @@ pragma = do m <- getPosition >>* sourcePosToMeta return (n, ProcName, n, fs, A.Proc m (A.PlainSpec, A.PlainRec) fs (A.Skip m)) else do sPROC origN <- anyName ProcName - fs <- formalList >>* map fst + fs <- formalList' sEq n <- newProcName return (n, ProcName, origN, fs, A.Proc m (A.PlainSpec, A.PlainRec) fs (A.Skip m)) <|> do ts <- tryVX (sepBy1 dataType sComma) sFUNCTION origN <- anyName FunctionName - fs <- formalList >>* map fst + fs <- formalList' sEq n <- newFunctionName return (n, FunctionName, origN, fs, A.Function m (A.PlainSpec, A.PlainRec) ts fs @@ -1451,6 +1451,10 @@ pragma = do m <- getPosition >>* sourcePosToMeta isPragma (Token _ p@(Pragma {})) = Just p isPragma _ = Nothing + formalList' = do fs <- formalList >>= scopeInFormals + scopeOutFormals fs + return fs + --}}} --{{{ processes process :: OccParser A.Process diff --git a/transformations/SimplifyExprs.hs b/transformations/SimplifyExprs.hs index 338daff..c3033cb 100644 --- a/transformations/SimplifyExprs.hs +++ b/transformations/SimplifyExprs.hs @@ -51,7 +51,15 @@ functionsToProcs = pass "Convert FUNCTIONs to PROCs" (Prop.agg_namesDone ++ [Prop.expressionTypesChecked, Prop.parUsageChecked, Prop.functionTypesChecked]) [Prop.functionsRemoved] - (applyDepthM doSpecification) + (\t -> do exts <- getCompState >>* csExternals + exts' <- sequence [do st <- specTypeOfName $ A.Name emptyMeta n + A.Specification _ _ st'@(A.Proc _ _ fs' _) <- + doSpecification $ A.Specification + (findMeta st) (A.Name emptyMeta n) st + return $ (n, (extType, fs')) + | (n, (extType, fs)) <- exts] + modify $ \cs -> cs { csExternals = exts' } + applyDepthM doSpecification t) where doSpecification :: A.Specification -> PassM A.Specification doSpecification (A.Specification m n (A.Function mf smrm rts fs evp))