Skip to content

Commit

Permalink
temporarily not using {-# SOURCE #-} pragma for *.Template in the sam…
Browse files Browse the repository at this point in the history
…e module when importing them in *.Interface.
  • Loading branch information
wavewave committed Sep 6, 2018
1 parent 876b4e6 commit 2045a16
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions fficxx/lib/FFICXX/Generate/Builder.hs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ simpleBuilder topLevelMod mumap (cabal,classes,toplevelfunctions,templates) extr


--
-- TODO: Template.hs-boot need to be generated as well
putStrLn "hs-boot file generation"
mapM_ (\m -> gen (m <.> "Interface" <.> "hs-boot") (prettyPrint (buildInterfaceHSBOOT m))) hsbootlst
--
Expand Down
20 changes: 17 additions & 3 deletions fficxx/lib/FFICXX/Generate/Code/HsFrontEnd.hs
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,23 @@ genImportInInterface m =
modlstparent = cmImportedModulesHighNonSource m
modlsthigh = cmImportedModulesHighSource m
in [mkImport (cmModule m <.> "RawType")]
<> map (\case Left t -> mkImport (getTClassModuleBase t <.> "Template"); Right c -> mkImport (getClassModuleBase c <.>"RawType")) modlstraw
<> map (\case Left t -> mkImport (getTClassModuleBase t <.> "Template"); Right c -> mkImport (getClassModuleBase c <.>"Interface")) modlstparent
<> map (\case Left t -> mkImportSrc (getTClassModuleBase t <.> "Template"); Right c -> mkImportSrc (getClassModuleBase c<.>"Interface")) modlsthigh
<> flip map modlstraw
(\case
Left t -> mkImport (getTClassModuleBase t <.> "Template")
Right c -> mkImport (getClassModuleBase c <.>"RawType")
)
<> flip map modlstparent
(\case
Left t -> mkImport (getTClassModuleBase t <.> "Template")
Right c -> mkImport (getClassModuleBase c <.>"Interface")
)
<> flip map modlsthigh
(\case
Left t -> -- TODO: *.Template in the same package needs to have hs-boot.
-- Currently, we do not have it yet.
mkImport (getTClassModuleBase t <.> "Template")
Right c -> mkImportSrc (getClassModuleBase c<.>"Interface")
)

-- |
genImportInCast :: ClassModule -> [ImportDecl ()]
Expand Down

0 comments on commit 2045a16

Please sign in to comment.