cmp: fix inlining of local closures

We have to compile the function expression in the environment in which
it was defined. Fixes #577.
This commit is contained in:
Marius Gerbershagen 2020-05-01 12:47:00 +02:00
parent fc5a9ad58c
commit 58f17f6c66

View file

@ -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)))