@@ -122,22 +122,30 @@ literals = mkPattern' match'
122 [ return $ emit $ lbl <> ": "
122 [ return $ emit $ lbl <> ": "
123 , prettyPrintJS' js
123 , prettyPrintJS' js
125− match (JSComment _ com js) = fmap mconcat $ sequence $
125+ match (JSComment _ com js) = mconcat <$> sequence
126+ [ mconcat <$> forM com comment
129+ match (JSRaw _ js) = return $ emit js
132+ comment :: (Emit gen) => Comment -> StateT PrinterState Maybe gen
133+ comment (LineComment com) = fmap mconcat $ sequence $
134+ [ return $ emit "\n"
136+ , return $ emit "//" <> emit com <> emit "\n"
138+ comment (BlockComment com) = fmap mconcat $ sequence $
126 [ return $ emit "\n"
139 [ return $ emit "\n"
127 , currentIndent
140 , currentIndent
128 , return $ emit "/**\n"
141 , return $ emit "/**\n"
130− map asLine (concatMap commentLines com) ++
143+ map asLine (T.lines com) ++
131 [ currentIndent
144 [ currentIndent
132 , return $ emit " */\n"
145 , return $ emit " */\n"
133 , currentIndent
146 , currentIndent
137− commentLines :: Comment -> [Text]
138− commentLines (LineComment s) = [s]
139− commentLines (BlockComment s) = T.lines s
141 asLine :: (Emit gen) => Text -> StateT PrinterState Maybe gen
149 asLine :: (Emit gen) => Text -> StateT PrinterState Maybe gen
142 asLine s = do
150 asLine s = do
143 i <- currentIndent
151 i <- currentIndent
@@ -150,8 +158,6 @@ literals = mkPattern' match'
150 Nothing -> case T.uncons t of
158 Nothing -> case T.uncons t of
151 Just (x, xs) -> x `T.cons` removeComments xs
159 Just (x, xs) -> x `T.cons` removeComments xs
152 Nothing -> ""
160 Nothing -> ""
153− match (JSRaw _ js) = return $ emit js
156conditional :: Pattern PrinterState JS ((Maybe SourceSpan, JS, JS), JS)
162conditional :: Pattern PrinterState JS ((Maybe SourceSpan, JS, JS), JS)
157conditional = mkPattern match
163conditional = mkPattern match