Commit d5ac2337178c750510cf11162fcf5b558e5b659b

Thomas de Grivel 2023-03-14T08:44:05

buf_parse_call_op

diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index d87b809..a74b1e4 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -205,7 +205,6 @@ sw buf_parse_call_op (s_buf *buf, s_call *dest)
 sw buf_parse_call_op_rec (s_buf *buf, s_call *dest, u8 min_precedence)
 {
   s_tag *left;
-  s_list *next_arg;
   s_ident next_op;
   s8 next_op_precedence;
   s_ident op;
@@ -221,9 +220,8 @@ sw buf_parse_call_op_rec (s_buf *buf, s_call *dest, u8 min_precedence)
   buf_save_init(buf, &save);
   call_init_op(&tmp);
   left = &tmp.arguments->tag;
-  next_arg = list_next(tmp.arguments);
-  right = &next_arg->tag;
-  *left = dest->arguments->tag;
+  right = &list_next(tmp.arguments)->tag;
+  tag_copy(&dest->arguments->tag, left);
   if ((r = buf_parse_ident_peek(buf, &next_op)) <= 0)
     goto clean;
   if ((op_precedence = operator_precedence(&next_op)) < 0) {
diff --git a/test/ic3/add.err.expected b/test/ic3/add.err.expected
deleted file mode 100644
index e69de29..0000000
--- a/test/ic3/add.err.expected
+++ /dev/null
diff --git a/test/ic3/add.in b/test/ic3/add.in
deleted file mode 100644
index ef1e503..0000000
--- a/test/ic3/add.in
+++ /dev/null
@@ -1,5 +0,0 @@
-quote 1 + 2
-quote 1 + 2 / 3
-quote 1 + 2 / 3 * 4
-quote 1 + 2 / 3 * 4 - 5
-quote 1 + 2 / 3 * 4 - 5
diff --git a/test/ic3/add.out.expected b/test/ic3/add.out.expected
deleted file mode 100644
index 7aac999..0000000
--- a/test/ic3/add.out.expected
+++ /dev/null
@@ -1,3 +0,0 @@
-quote 1 + 2
-
-3
diff --git a/test/ic3/add.ret.expected b/test/ic3/add.ret.expected
deleted file mode 100644
index 573541a..0000000
--- a/test/ic3/add.ret.expected
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/test/ic3/op.err.expected b/test/ic3/op.err.expected
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/ic3/op.err.expected
diff --git a/test/ic3/op.in b/test/ic3/op.in
new file mode 100644
index 0000000..3a87a8c
--- /dev/null
+++ b/test/ic3/op.in
@@ -0,0 +1,8 @@
+quote 1 + 2
+quote 1 + 2 / 3
+quote 1 + 2 / 3 * 4
+quote 1 + 2 / 3 * 4 - 5
+1 + 2
+1 + 2 / 3
+1 + 2 / 3 * 4
+1 + 2 / 3 * 4 - 5
diff --git a/test/ic3/op.out.expected b/test/ic3/op.out.expected
new file mode 100644
index 0000000..7aac999
--- /dev/null
+++ b/test/ic3/op.out.expected
@@ -0,0 +1,3 @@
+quote 1 + 2
+
+3
diff --git a/test/ic3/op.ret.expected b/test/ic3/op.ret.expected
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/ic3/op.ret.expected
@@ -0,0 +1 @@
+0