Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
parenscript
parenscript
Commits
4660ac20
Verified
Commit
4660ac20
authored
Nov 02, 2018
by
Vladimir Sedach
Browse files
Change (values) and equivalent to return undefined, not null
parent
b1a71d3b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/special-operators.lisp
View file @
4660ac20
...
...
@@ -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
)))
...
...
tests/eval-tests.lisp
View file @
4660ac20
...
...
@@ -350,7 +350,7 @@
(
test-js-eval
values0
((
lambda
()
(
values
)))
:
null
)
:
undefined
)
(
test-js-eval
mv-return1
(
progn
(
defun
foo
()
...
...
tests/output-tests.lisp
View file @
4660ac20
...
...
@@ -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();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment