From: David Vazquez Date: Sun, 27 Jan 2013 14:00:32 +0000 (+0000) Subject: Small optimization: (progn x) === x X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=5b789a53608b626f1a7f7a94646695d165c97a07;p=jscl.git Small optimization: (progn x) === x --- diff --git a/ecmalisp.lisp b/ecmalisp.lisp index 53449f2..95b3678 100644 --- a/ecmalisp.lisp +++ b/ecmalisp.lisp @@ -1352,7 +1352,9 @@ function mv(){ (ls-compile ,form))) (define-compilation progn (&rest body) - (js!selfcall (ls-compile-block body t))) + (if (null (cdr body)) + (ls-compile (car body) *multiple-value-p*) + (js!selfcall (ls-compile-block body t)))) (defun special-variable-p (x) (and (claimp x 'variable 'special) t)) @@ -1611,6 +1613,7 @@ function mv(){ "return args;" *newline*)) + ;;; A little backquote implementation without optimizations of any ;;; kind for ecmalisp. (defun backquote-expand-1 (form) @@ -2025,7 +2028,7 @@ function mv(){ (defun ls-compile-block (sexps &optional return-last-p) (if return-last-p (concat (ls-compile-block (butlast sexps)) - "return "(ls-compile (car (last sexps)) *multiple-value-p*) ";") + "return " (ls-compile (car (last sexps)) *multiple-value-p*) ";") (join-trailing (remove-if #'null-or-empty-p (mapcar #'ls-compile sexps)) (concat ";" *newline*))))