Prevent collisions in C namespace and function shadowing
This rework make functions being indexed by their unique C symbol name preventing multiple lisp function with the same name colliding.
This commit is contained in:
parent
9d8ce520f0
commit
d5f6dc131b
3 changed files with 81 additions and 41 deletions
|
@ -565,7 +565,7 @@ Each element is (INDEX . VALUE)")
|
|||
;; These are use by comp.el to spill data out of here
|
||||
(cl-defstruct byte-to-native-function
|
||||
"Named or anonymous function defined a top level."
|
||||
name data)
|
||||
name c-name data)
|
||||
(cl-defstruct byte-to-native-top-level
|
||||
"All other top level forms."
|
||||
form)
|
||||
|
@ -1094,6 +1094,8 @@ message buffer `default-directory'."
|
|||
(defvar byte-compile-current-file nil)
|
||||
(defvar byte-compile-current-group nil)
|
||||
(defvar byte-compile-current-buffer nil)
|
||||
(defvar byte-compile-not-top-level nil ; We'll evolve this for naming lambdas
|
||||
"Non nil if compiling something that is not top-level.")
|
||||
|
||||
;; Log something that isn't a warning.
|
||||
(defmacro byte-compile-log (format-string &rest args)
|
||||
|
@ -2916,6 +2918,7 @@ for symbols generated by the byte compiler itself."
|
|||
;; args of `list'. Actually, compile it to get warnings,
|
||||
;; but don't use the result.
|
||||
(let* ((form (nth 1 int))
|
||||
(byte-compile-not-top-level t)
|
||||
(newform (byte-compile-top-level form)))
|
||||
(while (memq (car-safe form) '(let let* progn save-excursion))
|
||||
(while (consp (cdr form))
|
||||
|
@ -3116,7 +3119,8 @@ for symbols generated by the byte compiler itself."
|
|||
(let* ((byte-compile-vector (byte-compile-constants-vector))
|
||||
(out (list 'byte-code (byte-compile-lapcode byte-compile-output)
|
||||
byte-compile-vector byte-compile-maxdepth)))
|
||||
(when byte-native-compiling
|
||||
(when (and byte-native-compiling
|
||||
(null byte-compile-not-top-level))
|
||||
;; Spill LAP for the native compiler here
|
||||
(push (cons byte-compile-current-form byte-compile-output)
|
||||
byte-to-native-lap))
|
||||
|
@ -3170,7 +3174,8 @@ for symbols generated by the byte compiler itself."
|
|||
;; byte-compile--for-effect flag too.)
|
||||
;;
|
||||
(defun byte-compile-form (form &optional for-effect)
|
||||
(let ((byte-compile--for-effect for-effect))
|
||||
(let ((byte-compile--for-effect for-effect)
|
||||
(byte-compile-not-top-level t))
|
||||
(cond
|
||||
((not (consp form))
|
||||
(cond ((or (not (symbolp form)) (macroexp--const-symbol-p form))
|
||||
|
@ -3944,7 +3949,8 @@ discarding."
|
|||
;; and (funcall (function foo)) will lose with autoloads.
|
||||
|
||||
(defun byte-compile-function-form (form)
|
||||
(let ((f (nth 1 form)))
|
||||
(let ((f (nth 1 form))
|
||||
(byte-compile-not-top-level t))
|
||||
(when (and (symbolp f)
|
||||
(byte-compile-warning-enabled-p 'callargs f))
|
||||
(byte-compile-function-warn f t (byte-compile-fdefinition f nil)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue