]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/cconv.el
Add new function dom-remove-node
[gnu-emacs] / lisp / emacs-lisp / cconv.el
index fa8240759336237fe5b9231121984edb90e9556c..50b1fe326618b0984db880620be3ecb7506ad055 100644 (file)
@@ -1,6 +1,6 @@
-;;; cconv.el --- Closure conversion for statically scoped Emacs lisp. -*- lexical-binding: t; coding: utf-8 -*-
+;;; cconv.el --- Closure conversion for statically scoped Emacs lisp. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2011-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2016 Free Software Foundation, Inc.
 
 ;; Author: Igor Kuzmin <kzuminig@iro.umontreal.ca>
 ;; Maintainer: emacs-devel@gnu.org
@@ -300,7 +300,8 @@ places where they originally did not directly appear."
                         (prog1 binder (setq binder (list binder)))
                        (when (cddr binder)
                          (byte-compile-log-warning
-                          (format "Malformed `%S' binding: %S" letsym binder)))
+                          (format-message "Malformed `%S' binding: %S"
+                                          letsym binder)))
                       (setq value (cadr binder))
                       (car binder)))
                (new-val
@@ -472,25 +473,28 @@ places where they originally did not directly appear."
         :fun-body ,(cconv--convert-function () body env form)))
 
     (`(setq . ,forms)                   ; setq special form
-     (let ((prognlist ()))
-       (while forms
-         (let* ((sym (pop forms))
-                (sym-new (or (cdr (assq sym env)) sym))
-                (value (cconv-convert (pop forms) env extend)))
-           (push (pcase sym-new
-                   ((pred symbolp) `(setq ,sym-new ,value))
-                   (`(car-safe ,iexp) `(setcar ,iexp ,value))
-                   ;; This "should never happen", but for variables which are
-                   ;; mutated+captured+unused, we may end up trying to `setq'
-                   ;; on a closed-over variable, so just drop the setq.
-                   (_ ;; (byte-compile-report-error
-                    ;;  (format "Internal error in cconv of (setq %s ..)"
-                    ;;          sym-new))
-                    value))
-                 prognlist)))
-       (if (cdr prognlist)
-           `(progn . ,(nreverse prognlist))
-         (car prognlist))))
+     (if (= (logand (length forms) 1) 1)
+         ;; With an odd number of args, let bytecomp.el handle the error.
+         form
+       (let ((prognlist ()))
+         (while forms
+           (let* ((sym (pop forms))
+                  (sym-new (or (cdr (assq sym env)) sym))
+                  (value (cconv-convert (pop forms) env extend)))
+             (push (pcase sym-new
+                     ((pred symbolp) `(setq ,sym-new ,value))
+                     (`(car-safe ,iexp) `(setcar ,iexp ,value))
+                     ;; This "should never happen", but for variables which are
+                     ;; mutated+captured+unused, we may end up trying to `setq'
+                     ;; on a closed-over variable, so just drop the setq.
+                     (_ ;; (byte-compile-report-error
+                      ;;  (format "Internal error in cconv of (setq %s ..)"
+                      ;;          sym-new))
+                      value))
+                   prognlist)))
+         (if (cdr prognlist)
+             `(progn . ,(nreverse prognlist))
+           (car prognlist)))))
 
     (`(,(and (or `funcall `apply) callsym) ,fun . ,args)
      ;; These are not special forms but we treat them separately for the needs
@@ -545,7 +549,7 @@ FORM is the parent form that binds this var."
     (`((,(and var (guard (eq ?_ (aref (symbol-name var) 0)))) . ,_)
        ,_ ,_ ,_ ,_)
      (byte-compile-log-warning
-      (format "%s `%S' not left unused" varkind var))))
+      (format-message "%s `%S' not left unused" varkind var))))
   (pcase vardata
     (`((,var . ,_) nil ,_ ,_ nil)
      ;; FIXME: This gives warnings in the wrong order, with imprecise line
@@ -557,8 +561,8 @@ FORM is the parent form that binds this var."
               (eq ?_ (aref (symbol-name var) 0))
              ;; As a special exception, ignore "ignore".
              (eq var 'ignored))
-       (byte-compile-log-warning (format "Unused lexical %s `%S'"
-                                         varkind var))))
+       (byte-compile-log-warning (format-message "Unused lexical %s `%S'"
+                                                 varkind var))))
     ;; If it's unused, there's no point converting it into a cons-cell, even if
     ;; it's captured and mutated.
     (`(,binder ,_ t t ,_)
@@ -678,7 +682,7 @@ and updates the data stored in ENV."
 
     ;; ((and `(quote ,v . ,_) (guard (assq v env)))
     ;;  (byte-compile-log-warning
-    ;;   (format "Possible confusion variable/symbol for `%S'" v)))
+    ;;   (format-message "Possible confusion variable/symbol for `%S'" v)))
 
     (`(quote . ,_) nil)                 ; quote form
     (`(function . ,_) nil)              ; same as quote