cmp: variable holding function has gensym as a name

Previously we've named the function's variable with the function name. That
could lead to a varible named (SETF FOO), and that can break down the road
because variable names are assumed to be symbols.

Moreover this change will prevent a possible fail scenario where we inline a
constant value with a known name instead of the function with the same name.
This commit is contained in:
Daniel Kochmański 2023-12-11 14:06:58 +01:00
parent 5f0cd1acad
commit 6fb6c7790f

View file

@ -38,7 +38,7 @@
"~s: The function ~s was already defined." origin (car def))
(push (car def) fnames)
(let* ((name (car def))
(var (make-var :name name :kind :object))
(var (make-var :name (gensym) :kind :object))
(fun (make-fun :name name :var var)))
(cmp-env-register-function fun new-env)
(push (cons fun (cdr def)) defs)))