Remove CODE use in convert-toplevel
[jscl.git] / src / compiler.lisp
index a806cf3..79bf250 100644 (file)
                     (js-expr arg)))))
              args))
 
-;;; Wrap X with a Javascript code to convert the result from
-;;; Javascript generalized booleans to T or NIL.
-(defun js!bool (x)
-  `(if ,x ,(ls-compile t) ,(ls-compile nil)))
-
 ;;; Concatenate the arguments and wrap them with a self-calling
 ;;; Javascript anonymous function. It is used to make some Javascript
 ;;; statements valid expressions and provide a private scope as well.
   `(define-raw-builtin ,op (x &rest args)
      (let ((args (cons x args)))
        (variable-arity args
-        (js!bool (comparison-conjuntion args ',sym))))))
+        `(bool ,(comparison-conjuntion args ',sym))))))
 
 (define-builtin-comparison > >)
 (define-builtin-comparison < <)
          (let ((form-string (prin1-to-string sexp)))
            (format t "Compiling ~a..." (truncate-string form-string))))
        (let ((code (ls-compile sexp multiple-value-p)))
-         `(code
-           ,@(interleave (get-toplevel-compilations) ";
-" t)
-           ,(when code
-                  `(code ,code ";"))))))))
+         `(progn
+            ,@(interleave (get-toplevel-compilations) '(code ";
+") t)
+            (code ,code ";")))))))
 
 (defun ls-compile-toplevel (sexp &optional multiple-value-p)
   (with-output-to-string (*standard-output*)