[latex3-commits] [git/LaTeX3-latex3-latex3] morechk: seq, clist use: make check conditional on debug (68010e3)

Will Robertson wspr81 at gmail.com
Mon Apr 15 13:44:45 CEST 2019


Repository : https://github.com/latex3/latex3
On branch  : morechk
Link       : https://github.com/latex3/latex3/commit/68010e3b871a04baa374feb684b0fd5f81473b44

>---------------------------------------------------------------

commit 68010e3b871a04baa374feb684b0fd5f81473b44
Author: Will Robertson <wspr81 at gmail.com>
Date:   Mon Jan 14 15:14:42 2019 +0800

    seq, clist use: make check conditional on debug


>---------------------------------------------------------------

68010e3b871a04baa374feb684b0fd5f81473b44
 l3kernel/l3clist.dtx |   52 +++++++++++++++++++++++++++++++++++---------------
 l3kernel/l3seq.dtx   |   50 +++++++++++++++++++++++++++++++++---------------
 2 files changed, 72 insertions(+), 30 deletions(-)

diff --git a/l3kernel/l3clist.dtx b/l3kernel/l3clist.dtx
index 172faba..a427c8c 100644
--- a/l3kernel/l3clist.dtx
+++ b/l3kernel/l3clist.dtx
@@ -519,7 +519,7 @@
 %
 % \section{Using the content of comma lists directly}
 %
-% \begin{function}[EXP, added = 2013-05-26]{\clist_use:Nnnn, \clist_use:cnnn}
+% \begin{function}[EXP, added = 2013-05-26, updated = 2019-01-14]{\clist_use:Nnnn, \clist_use:cnnn}
 %   \begin{syntax}
 %     \cs{clist_use:Nnnn} \meta{clist~var} \Arg{separator~between~two} \Arg{separator~between~more~than~two} \Arg{separator~between~final~two}
 %   \end{syntax}
@@ -531,7 +531,8 @@
 %   the comma list has exactly two items, then they are placed in the input
 %   stream separated by the \meta{separator between two}.  If the comma
 %   list has a single item, it is placed in the input stream, and a comma
-%   list with no items produces no output.  An error is raised if
+%   list with no items produces no output.  When the \texttt{check-declarations}
+%   option is in effect an error is raised if
 %   the variable does not exist or if it is invalid.
 %
 %   For example,
@@ -1806,27 +1807,48 @@
 %   switching to the other \meta{continuation}, \texttt{use_iii}, which
 %   uses the \meta{separator between final two}.
 %    \begin{macrocode}
-\cs_new:Npn \clist_use:Nnnn #1#2#3#4
+\__kernel_if_debug:TF
   {
-    \clist_if_exist:NTF #1
+    \cs_new:Npn \clist_use:Nnnn #1#2#3#4
       {
-        \int_case:nnF { \clist_count:N #1 }
+        \clist_if_exist:NTF #1
           {
-            { 0 } { }
-            { 1 } { \exp_after:wN \@@_use:wwn #1 , , { } }
-            { 2 } { \exp_after:wN \@@_use:wwn #1 , {#2} }
+            \int_case:nnF { \clist_count:N #1 }
+              {
+                { 0 } { }
+                { 1 } { \exp_after:wN \@@_use:wwn #1 , , { } }
+                { 2 } { \exp_after:wN \@@_use:wwn #1 , {#2} }
+              }
+              {
+                \exp_after:wN \@@_use:nwwwwnwn
+                \exp_after:wN { \exp_after:wN } #1 ,
+                \q_mark , { \@@_use:nwwwwnwn {#3} }
+                \q_mark , { \@@_use:nwwn {#4} }
+                \q_stop { }
+              }
           }
           {
-            \exp_after:wN \@@_use:nwwwwnwn
-            \exp_after:wN { \exp_after:wN } #1 ,
-            \q_mark , { \@@_use:nwwwwnwn {#3} }
-            \q_mark , { \@@_use:nwwn {#4} }
-            \q_stop { }
+            \__kernel_msg_expandable_error:nnn
+              { kernel } { bad-variable } {#1}
           }
       }
+  }
+  {
+    \cs_new:Npn \clist_use:Nnnn #1#2#3#4
       {
-        \__kernel_msg_expandable_error:nnn
-          { kernel } { bad-variable } {#1}
+            \int_case:nnF { \clist_count:N #1 }
+              {
+                { 0 } { }
+                { 1 } { \exp_after:wN \@@_use:wwn #1 , , { } }
+                { 2 } { \exp_after:wN \@@_use:wwn #1 , {#2} }
+              }
+              {
+                \exp_after:wN \@@_use:nwwwwnwn
+                \exp_after:wN { \exp_after:wN } #1 ,
+                \q_mark , { \@@_use:nwwwwnwn {#3} }
+                \q_mark , { \@@_use:nwwn {#4} }
+                \q_stop { }
+              }
       }
   }
 \cs_generate_variant:Nn \clist_use:Nnnn { c }
diff --git a/l3kernel/l3seq.dtx b/l3kernel/l3seq.dtx
index 336ffdc..7796a4d 100644
--- a/l3kernel/l3seq.dtx
+++ b/l3kernel/l3seq.dtx
@@ -592,7 +592,7 @@
 %
 % \section{Using the content of sequences directly}
 %
-% \begin{function}[EXP, added = 2013-05-26]{\seq_use:Nnnn, \seq_use:cnnn}
+% \begin{function}[EXP, added = 2013-05-26, updated = 2019-01-14]{\seq_use:Nnnn, \seq_use:cnnn}
 %   \begin{syntax}
 %     \cs{seq_use:Nnnn} \meta{seq~var} \Arg{separator~between~two} \Arg{separator~between~more~than~two} \Arg{separator~between~final~two}
 %   \end{syntax}
@@ -604,8 +604,8 @@
 %   sequence has exactly two items, then they are placed in the input stream
 %   separated by the \meta{separator between two}.  If the sequence has
 %   a single item, it is placed in the input stream, and an empty sequence
-%   produces no output.  An error is raised if the variable does
-%   not exist or if it is invalid.
+%   produces no output.  When the \texttt{check-declarations} option is in effect
+%   an error is raised if the variable does not exist or if it is invalid.
 %
 %   For example,
 %   \begin{verbatim}
@@ -1902,26 +1902,46 @@
 %   commas.  We also need to add \cs{@@_item:n} at various places, and
 %   \cs{s_@@}.
 %    \begin{macrocode}
-\cs_new:Npn \seq_use:Nnnn #1#2#3#4
+\__kernel_if_debug:TF
   {
-    \seq_if_exist:NTF #1
+    \cs_new:Npn \seq_use:Nnnn #1#2#3#4
       {
-        \int_case:nnF { \seq_count:N #1 }
+        \seq_if_exist:NTF #1
           {
-            { 0 } { }
-            { 1 } { \exp_after:wN \@@_use:NNnNnn #1 ? { } { } }
-            { 2 } { \exp_after:wN \@@_use:NNnNnn #1 {#2} }
+            \int_case:nnF { \seq_count:N #1 }
+              {
+                { 0 } { }
+                { 1 } { \exp_after:wN \@@_use:NNnNnn #1 ? { } { } }
+                { 2 } { \exp_after:wN \@@_use:NNnNnn #1 {#2} }
+              }
+              {
+                \exp_after:wN \@@_use_setup:w #1 \@@_item:n
+                \q_mark { \@@_use:nwwwwnwn {#3} }
+                \q_mark { \@@_use:nwwn {#4} }
+                \q_stop { }
+              }
           }
           {
-            \exp_after:wN \@@_use_setup:w #1 \@@_item:n
-            \q_mark { \@@_use:nwwwwnwn {#3} }
-            \q_mark { \@@_use:nwwn {#4} }
-            \q_stop { }
+            \__kernel_msg_expandable_error:nnn
+              { kernel } { bad-variable } {#1}
           }
       }
+  }
+  {
+    \cs_new:Npn \seq_use:Nnnn #1#2#3#4
       {
-        \__kernel_msg_expandable_error:nnn
-          { kernel } { bad-variable } {#1}
+            \int_case:nnF { \seq_count:N #1 }
+              {
+                { 0 } { }
+                { 1 } { \exp_after:wN \@@_use:NNnNnn #1 ? { } { } }
+                { 2 } { \exp_after:wN \@@_use:NNnNnn #1 {#2} }
+              }
+              {
+                \exp_after:wN \@@_use_setup:w #1 \@@_item:n
+                \q_mark { \@@_use:nwwwwnwn {#3} }
+                \q_mark { \@@_use:nwwn {#4} }
+                \q_stop { }
+              }
       }
   }
 \cs_generate_variant:Nn \seq_use:Nnnn { c }





More information about the latex3-commits mailing list