summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2022-02-10 08:24:24 +0000
committerSylvain Henry <sylvain@haskus.fr>2022-11-29 09:44:31 +0100
commitcc25d52e0f65d54c052908c7d91d5946342ab88a (patch)
tree0f35764ee3b9b0451ac999b64d2db9fa074fa3dd /compiler/GHC/Tc
parentdef47dd32491311289bff26230b664c895f178cc (diff)
downloadhaskell-cc25d52e0f65d54c052908c7d91d5946342ab88a.tar.gz
Add Javascript backend
Add JS backend adapted from the GHCJS project by Luite Stegeman. Some features haven't been ported or implemented yet. Tests for these features have been disabled with an associated gitlab ticket. Bump array submodule Work funded by IOG. Co-authored-by: Jeffrey Young <jeffrey.young@iohk.io> Co-authored-by: Luite Stegeman <stegeman@gmail.com> Co-authored-by: Josh Meredith <joshmeredith2008@gmail.com>
Diffstat (limited to 'compiler/GHC/Tc')
-rw-r--r--compiler/GHC/Tc/Gen/Foreign.hs4
-rw-r--r--compiler/GHC/Tc/Types.hs2
2 files changed, 5 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/Gen/Foreign.hs b/compiler/GHC/Tc/Gen/Foreign.hs
index e4b741f13a..caa7feeca7 100644
--- a/compiler/GHC/Tc/Gen/Foreign.hs
+++ b/compiler/GHC/Tc/Gen/Foreign.hs
@@ -340,6 +340,10 @@ tcCheckFIType arg_tys res_ty idecl@(CImport src (L lc cconv) (L ls safety) mh
-- prim import result is more liberal, allows (#,,#)
checkForeignRes nonIOok checkSafe (isFFIPrimResultTy dflags) res_ty
return (CImport src (L lc cconv) (L ls safety) mh (CFunction target))
+ | cconv == JavaScriptCallConv = do
+ checkCg (Right idecl) backendValidityOfCImport
+ -- leave the rest to the JS backend (at least for now)
+ return (CImport src (L lc cconv) (L ls safety) mh (CFunction target))
| otherwise = do -- Normal foreign import
checkCg (Right idecl) backendValidityOfCImport
cconv' <- checkCConv (Right idecl) cconv
diff --git a/compiler/GHC/Tc/Types.hs b/compiler/GHC/Tc/Types.hs
index 5c58a73701..e6d03af276 100644
--- a/compiler/GHC/Tc/Types.hs
+++ b/compiler/GHC/Tc/Types.hs
@@ -977,7 +977,7 @@ removeBindingShadowing bindings = reverse $ fst $ foldl
-- | Get target platform
-getPlatform :: TcM Platform
+getPlatform :: TcRnIf a b Platform
getPlatform = targetPlatform <$> getDynFlags
---------------------------