emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/tNFA 4771c2f 12/23: Redefined tNFA--NFA-state-create an


From: Stefan Monnier
Subject: [elpa] externals/tNFA 4771c2f 12/23: Redefined tNFA--NFA-state-create and tNFA--NFA-state-create-tag using defun
Date: Mon, 14 Dec 2020 12:08:30 -0500 (EST)

branch: externals/tNFA
commit 4771c2f51b2ade8b8235efadf806b553c8a1172a
Author: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>

    Redefined tNFA--NFA-state-create and tNFA--NFA-state-create-tag using defun
    to work around a mysterious byte-compiler bug somehow related to the dummy
    argument used in the defstruct definitions of the same.
---
 tNFA.el | 38 ++++++++++++++++++++++++++++----------
 1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/tNFA.el b/tNFA.el
index 9cb273b..41d18c5 100644
--- a/tNFA.el
+++ b/tNFA.el
@@ -146,16 +146,17 @@
   (tNFA--NFA-state
    (:type vector)
    (:constructor nil)
-   (:constructor tNFA--NFA-state-create
+   (:constructor tNFA---NFA-state-create
                 (&optional type label next
                  &aux
                  (in-degree 0)
                  (count 0)
                  (id (incf NFA--state-id))
-                 (dummy
-                  (when next
-                    (setf (tNFA--NFA-state-count next)
-                          (incf (tNFA--NFA-state-in-degree next)))))))
+                 ;; (dummy
+                 ;;  (when next
+                 ;;    (setf (tNFA--NFA-state-count next)
+                 ;;       (incf (tNFA--NFA-state-in-degree next)))))
+                 ))
    (:constructor tNFA--NFA-state-create-branch
                 (&rest next
                  &aux
@@ -163,7 +164,7 @@
                  (in-degree 0)
                  (count 0)
                  (id (incf NFA--state-id))))
-   (:constructor tNFA--NFA-state-create-tag
+   (:constructor tNFA---NFA-state-create-tag
                 (tag &optional next
                  &aux
                  (type 'tag)
@@ -171,16 +172,33 @@
                  (in-degree 0)
                  (count 0)
                  (id (incf NFA--state-id))
-                 (dummy
-                  (when next
-                    (setf (tNFA--NFA-state-count next)
-                          (incf (tNFA--NFA-state-in-degree next)))))))
+                 ;; (dummy
+                 ;;  (when next
+                 ;;    (setf (tNFA--NFA-state-count next)
+                 ;;       (incf (tNFA--NFA-state-in-degree next)))))
+                 ))
    (:copier nil))
   id type label in-degree
   count tNFA-state  ; used internally in NFA evolution algorithms
   next)
 
 
+;; Define these via defun instead of using the dummy argument in the
+;; above defstruct to work around a mysterious byte-compiler bug.
+
+(defun tNFA--NFA-state-create (&optional type label next)
+  (when next
+    (setf (tNFA--NFA-state-count next)
+         (incf (tNFA--NFA-state-in-degree next))))
+    (tNFA---NFA-state-create type label next))
+
+(defun tNFA--NFA-state-create-tag (tag &optional next)
+  (when next
+    (setf (tNFA--NFA-state-count next)
+         (incf (tNFA--NFA-state-in-degree next))))
+    (tNFA---NFA-state-create-tag tag next))
+
+
 ;; tag number for a tagged epsilon transition is stored in label slot
 (defalias 'tNFA--NFA-state-tag 'tNFA--NFA-state-label)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]