Commit 7df36942 authored by Boris Smilga's avatar Boris Smilga
Browse files

Merge pull request #19 from jasom/master

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