Permalink
Browse files

Added spaces and parens around + and - outputed from dec and inc. Added

semicolon at end of set! statements.
  • Loading branch information...
1 parent 12b85fc commit 491038367ee9990e56425779e2432b37e04fe3ec @scottjad scottjad committed Sep 17, 2010
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/com/reasonr/scriptjure.clj
@@ -167,8 +167,8 @@
(defmethod emit-special 'set! [type [set! var val & more]]
(assert (or (nil? more) (even? (count more))))
- (str (emit var) " = " (emit val)
- (if more (str statement-separator (emit (cons 'set! more))))))
+ (str (emit var) " = " (emit val) statement-separator
+ (if more (str (emit (cons 'set! more))))))
(defmethod emit-special 'new [type [new class & args]]
(str "new " (emit class) (comma-list (map emit args))))
@@ -183,10 +183,10 @@
(str (emit var) "--"))
(defmethod emit-special 'dec [type [_ var]]
- (str (emit var) "-" 1))
+ (str "(" (emit var) " - " 1 ")"))
(defmethod emit-special 'inc [type [_ var]]
- (str (emit var) "+" 1))
+ (str "(" (emit var) " + " 1 ")"))
(defmethod emit-special 'defined? [type [_ var]]
(str "typeof " (emit var) " !== \"undefined\" && " (emit var) " !== null"))

0 comments on commit 4910383

Please sign in to comment.