[parenscript-devel] [PATCH] Implementation of TRY-EXPRESSIONIZE-IF? that doesn't call the printer.

Vladimir Sedach vsedach at gmail.com
Sat Dec 17 20:49:31 UTC 2011


Hi Scott,

This issue has been fixed in one of the patches I just pushed. The
compiler no longer calls out to the printer twice.

Vladimir

On Wed, Aug 31, 2011 at 5:39 PM,  <sblist at me.com> wrote:
> I needed to avoid secondary calls to the printer for the purpose of
> generating source mappings, but this seems like a more precise
> definition anyway (unless I've missed something).
>
>        Scott
>
> ---
> src/special-operators.lisp |   14 ++++++++++----
> 1 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/src/special-operators.lisp b/src/special-operators.lisp
> index 3a77ae5..be95a5f 100644
> --- a/src/special-operators.lisp
> +++ b/src/special-operators.lisp
> @@ -130,10 +130,16 @@
>    `(ps-js:label ,name ,(wrap-block-for-dynamic-return name (compile-statement `(progn , at body))))))
>
> (defun try-expressionize-if? (form)
> -  (< (count #\Newline (with-output-to-string (*psw-stream*)
> -                        (let ((*ps-print-pretty* t))
> -                          (parenscript-print (compile-statement form) t))))
> -     (if (= (length form) 4) 5 4)))
> +  (destructuring-bind (if condition
> +                          (block . consequent)
> +                          &optional
> +                          else
> +                          alternative-block)
> +      (compile-statement form)
> +    (declare (ignore if condition else block))
> +    (and (= (length consequent) 1)
> +         (or (null alternative-block)
> +             (= (length alternative-block) 2)))))
>
> (define-statement-operator return-from (tag &optional result)
>  (if (not tag)
> --
> 1.7.6
>
>
>
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel




More information about the parenscript-devel mailing list