Commits

Tobias Dammers  committed 33d1f4d

JavaScript mode passes coalesce test

  • Participants
  • Parent commits ec24106

Comments (0)

Files changed (1)

File hpaco-lib/Text/HPaco/Writers/Javascript.hs

             writeExpression right
             write ")"
 
+        BinaryExpression OpCoalesce left right -> do
+            write "((function(a,b){if (a) return a; if (typeof(a) == 'undefined' || typeof(a) == 'object') return b; return a;})("
+            writeExpression left
+            write ","
+            writeExpression right
+            write "))"
+
         BinaryExpression o left right -> do
             let opstr = case o of
                             OpPlus -> "+"