Commit 371ef2241bab6edc1d4021c89daece166a89af0d

Thomas de Grivel 2024-05-26T18:38:50

fix buf_inspect_call_op

diff --git a/libc3/buf_inspect.c b/libc3/buf_inspect.c
index f300e63..8ef2266 100644
--- a/libc3/buf_inspect.c
+++ b/libc3/buf_inspect.c
@@ -553,7 +553,7 @@ sw buf_inspect_call_op (s_buf *buf, const s_call *call, s8 op_precedence)
   s_ident ident;
   s_tag *left;
   bool op;
-  bool paren;
+  bool paren = false;
   s8 precedence;
   sw r;
   sw result = 0;
@@ -561,19 +561,18 @@ sw buf_inspect_call_op (s_buf *buf, const s_call *call, s8 op_precedence)
   left = &call->arguments->tag;
   assert(list_next(call->arguments));
   right = &list_next(call->arguments)->tag;
-  if (! operator_find(&left->data.call.ident, &op))
-    return -1;
-  if (left->type == TAG_CALL &&
-      op &&
-      (precedence = operator_precedence(&left->data.call.ident))
-      < op_precedence) {
-    paren = true;
-    if ((r = buf_write_1(buf, "(")) < 0)
-      return r;
-    result += r;
+  if (left->type == TAG_CALL) {
+    if (! operator_find(&left->data.call.ident, &op))
+      return -1;
+    if (op &&
+        (precedence = operator_precedence(&left->data.call.ident))
+        < op_precedence) {
+      paren = true;
+      if ((r = buf_write_1(buf, "(")) < 0)
+        return r;
+      result += r;
+    }
   }
-  else
-    paren = false;
   if ((r = buf_inspect_tag(buf, left)) < 0)
     return r;
   result += r;