Commit cb4384f09086bf8857c1ee5b18250aa24bfd1d07

Thomas de Grivel 2023-08-02T16:30:00

fix tag_paren

diff --git a/lib/c3/0.1/c3.facts b/lib/c3/0.1/c3.facts
index 6644589..2fd5e7f 100644
--- a/lib/c3/0.1/c3.facts
+++ b/lib/c3/0.1/c3.facts
@@ -67,7 +67,7 @@ add {C3.!, :arity, 1}
 add {C3.!, :cfn, cfn :bool "tag_not" (:tag)}
 add {C3.!, :is_a, :operator}
 add {C3._"()", :arity, 1}
-add {C3._"()", :cfn, cfn :tag "tag_paren" (:tag)}
+add {C3._"()", :cfn, cfn :tag "tag_paren" (:tag, :&result)}
 add {C3._"()", :is_a, :operator}
 add {C3.&&, :arity, 2}
 add {C3.&&, :cfn, cfn :bool "tag_and" (:tag, :tag)}
diff --git a/libc3/tag.c b/libc3/tag.c
index 41076ce..e6ffc4d 100644
--- a/libc3/tag.c
+++ b/libc3/tag.c
@@ -1536,9 +1536,9 @@ bool tag_or (const s_tag *a, const s_tag *b)
   return compare_tag(a, &f) != 0 || compare_tag(b, &f) != 0;
 }
 
-s_tag * tag_paren (s_tag *a)
+s_tag * tag_paren (const s_tag *tag, s_tag *dest)
 {
-  return a;
+  return tag_copy(tag, dest);
 }
 
 s_tag * tag_s8 (s_tag *tag, s8 x)
diff --git a/libc3/tag.h b/libc3/tag.h
index 49256e8..aee4a9d 100644
--- a/libc3/tag.h
+++ b/libc3/tag.h
@@ -96,7 +96,7 @@ e_bool             tag_is_bound_var (const s_tag *tag);
 e_bool             tag_is_number (const s_tag *tag);
 e_bool             tag_is_unbound_var (const s_tag *tag);
 s8                 tag_number_compare (const s_tag *a, const s_tag *b);
-s_tag *            tag_paren (s_tag *a);
+s_tag *            tag_paren (const s_tag *tag, s_tag *dest);
 sw                 tag_size (const s_tag *tag);
 void *             tag_to_ffi_pointer (s_tag *tag, const s_sym *type);
 ffi_type           tag_to_ffi_type(const s_tag *tag);