@@ -108,22 +108,25 @@ makeExportDecls :: Map Name LDecl -> ExportIFace -> [Text]
108makeExportDecls defs (Export _ _ e) =
108makeExportDecls defs (Export _ _ e) =
109 concatMap makeExport e
109 concatMap makeExport e
111− uncurryF name argTy (Just args) =
111+ uncurryF name argTy (Just args) retTy =
112− if length argTy == length args then name
112+ if length argTy == length args then
113+ case (retTy, length args) of
114+ (FIO _, 0) -> T.concat ["function(){return ", name, "()()}"]
113 else T.concat [ "function(){ return "
116 else T.concat [ "function(){ return "
115 , ".apply(this, Array.prototype.slice.call(arguments, 0,", T.pack $ show $ length args,"))"
118 , ".apply(this, Array.prototype.slice.call(arguments, 0,", T.pack $ show $ length args,"))"
116 , T.concat $ map (\x -> T.concat ["(arguments[", T.pack $ show x , "])"]) [length args .. (length argTy - 1)]
119 , T.concat $ map (\x -> T.concat ["(arguments[", T.pack $ show x , "])"]) [length args .. (length argTy - 1)]
119− uncurryF name argTy Nothing = name
122+ uncurryF name argTy Nothing retTy = name
121 makeExport (ExportData _) =
124 makeExport (ExportData _) =
123 makeExport (ExportFun name (FStr exportname) retTy argTy) =
126 makeExport (ExportFun name (FStr exportname) retTy argTy) =
124 [T.concat [ T.pack $ exportname
127 [T.concat [ T.pack $ exportname
126− , uncurryF (jsName name) argTy (getArgList' name defs)
129+ , uncurryF (jsName name) argTy (getArgList' name defs) retTy