git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Restore module merging in generated code
commit5a782cec475e0b6f4cd5f90af239a5c6c835c199 authorGary Burgess <gary.burgess@gmail.com> dateTue 11 Feb 2014, 16:59 (13 years ago) parente5e522f
1 file changed+2−2
src/Language/PureScript/CodeGen/JS.hs+2−2
src/Language/PureScript/CodeGen/JS.hs+2−2
@@ -55,7 +55,7 @@ moduleToJs :: Options -> Module -> Environment -> JS
5555moduleToJs opts (Module pname@(ProperName name) decls) env =
5656 JSAssignment (JSAccessor name (JSVar "_ps")) $ JSApp (JSFunction Nothing ["module"]
5757 (JSBlock $ jsDecls ++ [JSReturn $ JSVar "module"]))
58− [JSObjectLiteral []]
58+ [(JSBinary Or (JSAccessor name (JSVar "_ps")) (JSObjectLiteral []))]
5959 where
6060 jsDecls = (concat $ mapMaybe (\decl -> fmap (map $ optimize opts) $ declToJs opts (ModuleName pname) decl env) (decls))
6161
@@ -347,5 +347,5 @@ wrapExportsContainer modules = JSApp (JSFunction Nothing ["_ps"] $ JSBlock $ (JS
347347 where exportSelector = JSConditional (JSBinary And (JSBinary NotEqualTo (JSTypeOf $ JSVar "module") (JSStringLiteral "undefined")) (JSAccessor "exports" (JSVar "module")))
348348 (JSAccessor "exports" (JSVar "module"))
349349 (JSConditional (JSBinary NotEqualTo (JSTypeOf $ JSVar "window") (JSStringLiteral "undefined"))
350− (JSAssignment (JSAccessor "PS" (JSVar "window")) (JSObjectLiteral []))
350+ (JSAssignment (JSAccessor "PS" (JSVar "window")) (JSBinary Or (JSAccessor "PS" (JSVar "window")) (JSObjectLiteral [])))
351351 (JSApp (JSFunction Nothing [] $ JSBlock [JSThrow $ JSStringLiteral "PureScript doesn't know how to export modules in the current environment"]) []))