diff options
author | romes <rodrigo.m.mesquita@gmail.com> | 2022-06-13 23:22:06 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-07-06 13:50:27 -0400 |
commit | acc1816b9153f134a3308d13b90d67bfcb123d87 (patch) | |
tree | 21a683d1081e9c6755ff5fac426be872505d8e8c /compiler/GHC/Parser/PostProcess.hs | |
parent | e4eea07b808bea530cf4b4fd2468035dd2cad67b (diff) | |
download | haskell-acc1816b9153f134a3308d13b90d67bfcb123d87.tar.gz |
TTG for ForeignImport/Export
Add a TTG parameter to both `ForeignImport` and `ForeignExport` and,
according to #21592, move the GHC-specific bits in them and in the other
AST data types related to foreign imports and exports to the TTG
extension point.
Diffstat (limited to 'compiler/GHC/Parser/PostProcess.hs')
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index 486517ea2b..97768931e9 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -2650,7 +2650,7 @@ mkImport cconv safety (L loc (StringLiteral esrc entity _), v, ty) = PsErrMalformedEntityString Just importSpec -> return importSpec - isCWrapperImport (CImport _ _ _ CWrapper _) = True + isCWrapperImport (CImport _ _ _ _ CWrapper) = True isCWrapperImport _ = False -- currently, all the other import conventions only support a symbol name in @@ -2661,7 +2661,7 @@ mkImport cconv safety (L loc (StringLiteral esrc entity _), v, ty) = then mkExtName (unLoc v) else entity funcTarget = CFunction (StaticTarget esrc entity' Nothing True) - importSpec = CImport cconv safety Nothing funcTarget (L loc esrc) + importSpec = CImport (L loc esrc) cconv safety Nothing funcTarget returnSpec spec = return $ \ann -> ForD noExtField $ ForeignImport { fd_i_ext = ann @@ -2677,7 +2677,7 @@ mkImport cconv safety (L loc (StringLiteral esrc entity _), v, ty) = -- that one. parseCImport :: Located CCallConv -> Located Safety -> FastString -> String -> Located SourceText - -> Maybe ForeignImport + -> Maybe (ForeignImport (GhcPass p)) parseCImport cconv safety nm str sourceText = listToMaybe $ map fst $ filter (null.snd) $ readP_to_S parse str @@ -2704,7 +2704,7 @@ parseCImport cconv safety nm str sourceText = | id_char c -> pfail _ -> return () - mk h n = CImport cconv safety h n sourceText + mk h n = CImport sourceText cconv safety h n hdr_char c = not (isSpace c) -- header files are filenames, which can contain @@ -2739,8 +2739,7 @@ mkExport :: Located CCallConv mkExport (L lc cconv) (L le (StringLiteral esrc entity _), v, ty) = return $ \ann -> ForD noExtField $ ForeignExport { fd_e_ext = ann, fd_name = v, fd_sig_ty = ty - , fd_fe = CExport (L lc (CExportStatic esrc entity' cconv)) - (L le esrc) } + , fd_fe = CExport (L le esrc) (L lc (CExportStatic esrc entity' cconv)) } where entity' | nullFS entity = mkExtName (unLoc v) | otherwise = entity |