Verified Commit 4660ac20 authored by Vladimir Sedach's avatar Vladimir Sedach
Browse files

Change (values) and equivalent to return undefined, not null

parent b1a71d3b
......@@ -351,10 +351,12 @@
(list tag)
(ps-compile `(return-from ,tag (progn ,@(cddr form))))))))
(values
(with-ps-gensyms (val)
`(let ((,val ,(cadr form)))
(setf __PS_MV_REG (list ,@(cddr form)))
(return-from ,tag ,val t))))
(if (cddr form)
(with-ps-gensyms (val)
`(let ((,val ,(cadr form)))
(setf __PS_MV_REG (list ,@(cddr form)))
(return-from ,tag ,val t)))
`(return-from ,tag ,@(cdr form))))
(values-list
(with-ps-gensyms (values-list firstval)
`(let ((,values-list (funcall (getprop ,(cadr form) 'slice))))
......@@ -376,12 +378,15 @@ Parenscript now implements implicit return, update your code! Things like (lambd
(t (compile-statement form))))))))
(define-statement-operator return-from (tag &optional
result returning-values?)
(result nil result?)
returning-values?)
(setq tag (or tag 'nilBlock))
(let ((form (ps-macroexpand result)))
(if (atom form)
(return-exp tag form)
(return-result-of tag form))))
(if result?
(let ((form (ps-macroexpand result)))
(if (atom form)
(return-exp tag form)
(return-result-of tag form)))
(return-exp tag)))
(define-statement-operator throw (&rest args)
`(ps-js:throw ,@(mapcar #'compile-expression args)))
......
......@@ -350,7 +350,7 @@
(test-js-eval values0
((lambda () (values)))
:null)
:undefined)
(test-js-eval mv-return1
(progn (defun foo ()
......
......@@ -1205,7 +1205,7 @@ __setf_someThing('foo', 1, 2);")
(test-ps-js return-nothing
(defun foo () (return-from foo))
"function foo() {
return null;
return;
};")
(test-ps-js return-values
......@@ -3151,7 +3151,7 @@ a === b;")
foo();
if (bar()) {
__PS_MV_REG = [];
return null;
return;
};
__PS_MV_REG = [];
return blee();
......@@ -3168,7 +3168,7 @@ a === b;")
foo();
if (bar()) {
__PS_MV_REG = [];
return null;
return;
};
__PS_MV_REG = [];
return blee();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment