X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fcompiler-codegen.lisp;h=129f892988bc1a2a63941cde70e9a0e927015c4e;hb=81acf0d435f13d0850a0fa48b7502e8b3ea8f2d0;hp=fbb3952909c86b0d5d04228e203db8a47b45c8cc;hpb=afb6a14b45bf0734ce9b06d3c299036ad8792d40;p=jscl.git diff --git a/src/compiler-codegen.lisp b/src/compiler-codegen.lisp index fbb3952..129f892 100644 --- a/src/compiler-codegen.lisp +++ b/src/compiler-codegen.lisp @@ -211,6 +211,8 @@ (let ((op1 (car args)) (op2 (cadr args))) (case op + (code + (js-format "~a" (apply #'code args))) ;; Function call (call (js-expr (car args)) @@ -358,7 +360,7 @@ (destructuring-bind (&body body) (cdr form) (cond ((null body) '(empty)) - ((null (cdr body)) (car body)) + ((null (cdr body)) (js-expand-stmt (car body))) (t `(group ,@(cdr form)))))) (t form))) @@ -371,6 +373,8 @@ (js-expr form) (js-format ";")) (case (car form) + (code + (js-format "~a" (apply #'code (cdr form)))) (empty (unless (and (consp parent) (eq (car parent) 'group)) (js-format ";"))) @@ -415,7 +419,9 @@ (js-format " else ") (js-stmt false)))) (group - (let ((in-group-p (and (consp parent) (eq (car parent) 'group)))) + (let ((in-group-p + (or (null parent) + (and (consp parent) (eq (car parent) 'group))))) (unless in-group-p (js-format "{")) (mapc #'js-stmt (cdr form)) (unless in-group-p (js-format "}"))))