git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Don't attempt to merge modules in generated JS
commitf1c71f3157f43d53f8456036406b330b6b465b26 authorGary Burgess <gary.burgess@gmail.com> dateTue 11 Mar 2014, 23:12 (13 years ago) parent13849b6
1 file changed+6−3
src/Language/PureScript/CodeGen/JS.hs+6−3
src/Language/PureScript/CodeGen/JS.hs+6−3
@@ -52,11 +52,14 @@ moduleToJs opts (Module name decls (Just exps)) env =
5252 case jsDecls of
5353 [] -> Nothing
5454 _ -> Just $ JSAssignment (JSAccessor (moduleNameToJs name) (JSVar C._ps)) $
55− JSApp (JSFunction Nothing ["module"] (JSBlock $ jsDecls ++ [JSReturn $ JSVar "module"]))
56− [JSBinary Or (JSAccessor (moduleNameToJs name) (JSVar C._ps)) (JSObjectLiteral [])]
55+ JSApp (JSFunction Nothing [] (JSBlock $
56+ JSVariableIntroduction "module" (Just $ JSObjectLiteral []) :
57+ jsDecls ++
58+ jsExports ++
59+ [JSReturn $ JSVar "module"])) []
5760 where
5861 jsDecls = (concat $ mapMaybe (\decl -> fmap (map $ optimize opts) $ declToJs opts name decl env) decls)
59− ++ concatMap exportToJs exps
62+ jsExports = concatMap exportToJs exps
6063moduleToJs _ _ _ = error "Exports should have been elaborated in name desugaring"
6164
6265-- |