From 5b789a53608b626f1a7f7a94646695d165c97a07 Mon Sep 17 00:00:00 2001 From: David Vazquez Date: Sun, 27 Jan 2013 14:00:32 +0000 Subject: [PATCH] Small optimization: (progn x) === x --- ecmalisp.lisp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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*)))) -- 1.7.10.4