diff options
author | Andrea Corallo <akrl@sdf.org> | 2020-03-28 20:56:47 +0000 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2020-03-29 12:30:33 +0100 |
commit | d5f6dc131b63d6bde096c03927c05a490c707c41 (patch) | |
tree | 59f84f98aab7fb446fb79ceca31ffca1b70b3574 /lisp/emacs-lisp/bytecomp.el | |
parent | 9d8ce520f03217e5aaf08b3e252a1bb82c3fc641 (diff) | |
download | emacs-d5f6dc131b63d6bde096c03927c05a490c707c41.tar.gz emacs-d5f6dc131b63d6bde096c03927c05a490c707c41.tar.bz2 emacs-d5f6dc131b63d6bde096c03927c05a490c707c41.zip |
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.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index fe5616be668..977f137b793 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -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))) |