From 58f17f6c66007cd6b6bb6b59dc2f98ef17ceecdf Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Fri, 1 May 2020 12:47:00 +0200 Subject: [PATCH] cmp: fix inlining of local closures We have to compile the function expression in the environment in which it was defined. Fixes #577. --- src/cmp/cmpeval.lsp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cmp/cmpeval.lsp b/src/cmp/cmpeval.lsp index ea5dcbb4f..5d03403c3 100644 --- a/src/cmp/cmpeval.lsp +++ b/src/cmp/cmpeval.lsp @@ -104,8 +104,9 @@ (declared-inline-p fname) (plusp *inline-max-depth*)) (return-from c1call-local - (let ((*inline-max-depth* (1- *inline-max-depth*))) - `(funcall #',lambda ,@args))))) + (let ((*inline-max-depth* (1- *inline-max-depth*)) + (*cmp-env* (fun-cmp-env fun))) + (c1expr `(funcall #',lambda ,@args)))))) (let* ((forms (c1args* args)) (return-type (or (get-local-return-type fun) 'T)) (arg-types (get-local-arg-types fun)))