From 116f9ca9da5c0ddd227832ba82865856a9b4e0b1 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Wed, 4 Mar 2015 21:52:45 -0800 Subject: [PATCH] Preserve "this" in implicit lambdas --- src/compiler.lisp | 2 +- src/lib/ps-loop.lisp | 2 +- src/special-operators.lisp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler.lisp b/src/compiler.lisp index bbc7c49..7b05ec1 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -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) diff --git a/src/lib/ps-loop.lisp b/src/lib/ps-loop.lisp index 69619af..55e39e5 100644 --- a/src/lib/ps-loop.lisp +++ b/src/lib/ps-loop.lisp @@ -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)))) diff --git a/src/special-operators.lisp b/src/special-operators.lisp index e429972..8b12750 100644 --- a/src/special-operators.lisp +++ b/src/special-operators.lisp @@ -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) -- 2.11.4.GIT