Commit 0e2eef3d authored by Vladimir Sedach's avatar Vladimir Sedach

Fixed bug with function arguments not being respected for renaming by LET....

Fixed bug with function arguments not being respected for renaming by LET. Thanks to Scott Bell for the bug report.
parent f1009119
......@@ -77,6 +77,7 @@ lexical block.")
(defvar *local-function-names* ())
;; is a subset of
(defvar *enclosing-lexicals* ())
(defvar *enclosing-function-arguments* ())
(defvar *function-block-names* ())
(defvar *lexical-extent-return-tags* ())
(defvar *dynamic-extent-return-tags* ())
......
......@@ -113,6 +113,7 @@ Syntax of key spec:
(defun compile-function-body (args body)
(with-declaration-effects (body body)
(let* ((*enclosing-lexical-block-declarations* ())
(*enclosing-function-arguments* (append args *enclosing-function-arguments*))
(*enclosing-lexicals* (set-difference *enclosing-lexicals* args))
(body (let ((in-loop-scope? nil)
(*loop-scope-lexicals* ())
......
......@@ -348,6 +348,7 @@
normalized-bindings)))
(flet ((maybe-rename-lexical-var (x)
(if (or (member x *enclosing-lexicals*)
(member x *enclosing-function-arguments*)
(lookup-macro-def x *symbol-macro-env*)
(member x free-variables-in-binding-value-expressions))
(ps-gensym (string x))
......
......@@ -31,3 +31,9 @@
(array)
(js-array (make-array 0 :adjustable t)))
(test-js-eval funargs-let1
((lambda (x)
(let ((x 10))
(incf x))
(incf x)) 0)
1)
......@@ -2862,3 +2862,14 @@ function (x) {
(test-ps-js divide-expressions1
(floor (1- x) y)
"Math.floor((x - 1) / y);")
(test-ps-js lexical-funargs-shadow1
(lambda (x)
(let ((x 1))
(foo x))
(incf x))
"function (x) {
var x1 = 1;
foo(x1);
return ++x;
};")
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