module FreeC.Backend.Coq.Converter.FuncDecl.Rec ( convertRecFuncDecls ) where
import FreeC.Backend.Coq.Analysis.ConstantArguments
import FreeC.Backend.Coq.Converter.FuncDecl.Rec.WithHelpers
import FreeC.Backend.Coq.Converter.FuncDecl.Rec.WithSections
import qualified FreeC.Backend.Coq.Syntax as Coq
import qualified FreeC.IR.Syntax as IR
import FreeC.Monad.Converter
convertRecFuncDecls :: [IR.FuncDecl] -> Converter [Coq.Sentence]
convertRecFuncDecls decls = localEnv $ do
constArgs <- identifyConstArgs decls
if null constArgs
then convertRecFuncDeclsWithHelpers decls
else convertRecFuncDeclsWithSection constArgs decls