git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #1436 from zudov/foreign-keyword
5fdc977Phil Freeman
src/Language/PureScript/CodeGen/JS.hs+2−2
@@ -55,14 +55,14 @@ import System.FilePath.Posix ((</>))
55--
55--
56moduleToJs :: forall m. (Applicative m, Monad m, MonadReader Options m, MonadSupply m)
56moduleToJs :: forall m. (Applicative m, Monad m, MonadReader Options m, MonadSupply m)
57 => Module Ann -> Maybe JS -> m [JS]
57 => Module Ann -> Maybe JS -> m [JS]
58−moduleToJs (Module coms mn imps exps foreigns decls) foreign = do
58+moduleToJs (Module coms mn imps exps foreigns decls) foreign_ = do
59 jsImports <- T.traverse importToJs . delete (ModuleName [ProperName C.prim]) . (\\ [mn]) $ imps
59 jsImports <- T.traverse importToJs . delete (ModuleName [ProperName C.prim]) . (\\ [mn]) $ imps
60 jsDecls <- mapM bindToJs decls
60 jsDecls <- mapM bindToJs decls
61 optimized <- T.traverse (T.traverse optimize) jsDecls
61 optimized <- T.traverse (T.traverse optimize) jsDecls
62 comments <- not <$> asks optionsNoComments
62 comments <- not <$> asks optionsNoComments
63 let strict = JSStringLiteral "use strict"
63 let strict = JSStringLiteral "use strict"
64 let header = if comments && not (null coms) then JSComment coms strict else strict
64 let header = if comments && not (null coms) then JSComment coms strict else strict
65− let foreign' = [JSVariableIntroduction "$foreign" foreign | not $ null foreigns || foreign == Nothing]
65+ let foreign' = [JSVariableIntroduction "$foreign" foreign_ | not $ null foreigns || foreign_ == Nothing]
66 let moduleBody = header : foreign' ++ jsImports ++ concat optimized
66 let moduleBody = header : foreign' ++ jsImports ++ concat optimized
67 let foreignExps = exps `intersect` (fst `map` foreigns)
67 let foreignExps = exps `intersect` (fst `map` foreigns)
68 let standardExps = exps \\ foreignExps
68 let standardExps = exps \\ foreignExps