Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
parenscript
parenscript
Commits
7f78b9b7
Verified
Commit
7f78b9b7
authored
Oct 23, 2018
by
Vladimir Sedach
Browse files
MAYBE-ONCE-ONLY now handles all kinds of macros
parent
fe0fad36
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/compiler.lisp
View file @
7f78b9b7
...
...
@@ -386,15 +386,11 @@ except that if the given VARS are variables or constants, no intermediate variab
((
,
vars-bound
())
,@
(
loop
for
var
in
vars
collect
`
(
,
var
(
if
(
or
(
constantp
,
var
)
(
and
(
symbolp
,
var
)
(
not
(
lookup-macro-def
,
var
*symbol-macro-env*
))
(
not
(
gethash
,
var
*symbol-macro-toplevel*
))))
,
var
(
let
((
var
¹
(
ps-gensym
',var
)))
(
push
(
list
var
¹
,
var
)
,
vars-bound
)
var
¹
)))))
`
(
let
,
(
reverse
,
vars-bound
)
(
let
((
form
(
ps-macroexpand
,
var
)))
(
if
(
atom
form
)
form
(
let
((
var
¹
(
ps-gensym
',var
)))
(
push
(
list
var
¹
form
)
,
vars-bound
)
var
¹
))))))
`
(
let*
,
(
reverse
,
vars-bound
)
,,@
body
))))
tests/output-tests.lisp
View file @
7f78b9b7
...
...
@@ -4209,3 +4209,13 @@ x = 2 + sideEffect() + x + 5;")
var y2 = fun2();
return x1 + x1 + y2 + y2;
})();"
)
(
test-ps-js
maybe-once-only-macroexpansion
(
macrolet
((
A
(
x
y
)
(
ps:maybe-once-only
(
x
y
)
`
(
+
,
x
,
x
,
y
,
y
)))
(
fun1
()
'G
)
(
fun2
()
6
))
(
A
(
fun1
)
(
fun2
)))
"G + G + 6 + 6;"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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