From: David Vázquez Date: Fri, 5 Jul 2013 01:50:31 +0000 (+0200) Subject: Migrate MULTIPLE-VALUE-CALL X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=e67d2740ede296b8871d3300fa74212a677d6075;p=jscl.git Migrate MULTIPLE-VALUE-CALL --- diff --git a/src/compiler.lisp b/src/compiler.lisp index 866cea2..a6f435f 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -896,23 +896,23 @@ `(return |ret|))) (define-compilation multiple-value-call (func-form &rest forms) - (js!selfcall - "var func = " (ls-compile func-form) ";" - "var args = [" (if *multiple-value-p* "values" "pv") ", 0];" - "return " - (js!selfcall - "var values = mv;" - "var vs;" - `(code - ,@(mapcar (lambda (form) - `(code "vs = " ,(ls-compile form t) ";" - "if (typeof vs === 'object' && 'multiple-value' in vs)" - (code " args = args.concat(vs);" ) - " else " - (code "args.push(vs);" ))) - forms)) - "args[1] = args.length-2;" - "return func.apply(window, args);" ) ";" )) + (js!selfcall* + `(var (func ,(ls-compile func-form)) + (args ,(vector (if *multiple-value-p* '|values| '|pv|) 0)) + (|values| |mv|) + vs) + `(progn + ,@(mapcar (lambda (form) + `(progn + (= vs ,(ls-compile form t)) + (if (and (=== (typeof vs) "object") + (in "multiple-value" vs)) + (= args (call (get args "concat") vs)) + (call (get args "push") vs)))) + forms)) + `(= (property args 1) (- (get args "length") 2)) + `(return (call (get func "apply") |window| args)))) + (define-compilation multiple-value-prog1 (first-form &rest forms) (js!selfcall