Verified Commit 7618c052 authored by Vladimir Sedach's avatar Vladimir Sedach
Browse files

Fix MAYBE-ONCE-ONLY to evaluate arguments in order given

parent 1704422e
......@@ -395,5 +395,5 @@ except that if the given VARS are variables or constants, no intermediate variab
(let ((var¹ (ps-gensym ',var)))
(push (list var¹ ,var) ,vars-bound)
var¹)))))
`(let ,,vars-bound
`(let ,(reverse ,vars-bound)
,,@body))))
......@@ -4197,3 +4197,15 @@ x = 2 + sideEffect() + x + 5;")
var x1 = callMeOnce();
return (Math.exp(x1) - Math.exp(-x1)) / (Math.exp(x1) + Math.exp(-x1));
})();")
(test-ps-js maybe-once-only-evaluation-order
(macrolet
((A (x y)
(maybe-once-only (x y)
`(+ ,x ,x ,y ,y))))
(A (fun1) (fun2)))
"(function () {
var x1 = fun1();
var y2 = fun2();
return x1 + x1 + y2 + y2;
})();")
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