Commit 116f9ca9 authored by Jason Miller's avatar Jason Miller
Browse files

Preserve "this" in implicit lambdas

parent 101b09ed
...@@ -247,7 +247,7 @@ form, FORM, returns the new value for *compilation-level*." ...@@ -247,7 +247,7 @@ form, FORM, returns the new value for *compilation-level*."
(expression-impl (expression-impl
(apply expression-impl (cdr form))) (apply expression-impl (cdr form)))
((member op *lambda-wrappable-statements*) ((member op *lambda-wrappable-statements*)
(compile-expression `((lambda () ,form)))) (compile-expression `(chain (lambda () ,form) (call this))))
(t (error 'compile-expression-error :form form))))) (t (error 'compile-expression-error :form form)))))
(defun ps-compile (form) (defun ps-compile (form)
......
...@@ -403,5 +403,5 @@ ...@@ -403,5 +403,5 @@
,@(awhen (accum-var state) (list it)))) ,@(awhen (accum-var state) (list it))))
(full `(block ,(name state) ,@(prologue-wrap (prologue state) main)))) (full `(block ,(name state) ,@(prologue-wrap (prologue state) main))))
(if (accum-var state) (if (accum-var state)
`((lambda () ,full)) `(chain (lambda () ,full) (call this))
full)))) full))))
...@@ -418,7 +418,7 @@ Parenscript now implements implicit return, update your code! Things like (lambd ...@@ -418,7 +418,7 @@ Parenscript now implements implicit return, update your code! Things like (lambd
(ps-gensym (symbol-name x)))) (ps-gensym (symbol-name x))))
(defun with-lambda-scope (body) (defun with-lambda-scope (body)
(prog1 `((lambda () ,body)) (prog1 `(chain (lambda () ,body) (call this))
(setf *vars-needing-to-be-declared* ()))) (setf *vars-needing-to-be-declared* ())))
(define-expression-operator let (bindings &body body) (define-expression-operator let (bindings &body body)
......
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