From patchwork Tue Feb 21 12:02:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 60047 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1843004wrn; Tue, 21 Feb 2023 04:51:28 -0800 (PST) X-Google-Smtp-Source: AK7set8ix5xxzgSLdfoSYEXeaeJH0VIm3dbf3giMFK/t/oHe9KYS/4Xcbgi+1XctamhuG9s7Jl7t X-Received: by 2002:a17:907:ea2:b0:888:b764:54e5 with SMTP id ho34-20020a1709070ea200b00888b76454e5mr14975839ejc.71.1676983888341; Tue, 21 Feb 2023 04:51:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676983888; cv=none; d=google.com; s=arc-20160816; b=VeDvwT16Gsp2nKTMM93zRLn4xbpqTqUPFMM53wlXpaxiczKAvIdolf8DqyLIyTCjpz LWQgF+R8goozGDrafmDECgU1iOLlcfR7aP2wDjpSvRkiEb5j6nuUM/M/gZss3QEgOg8y enR4D/s1JjK7tAZyr6kHiZpO0VWiGRp6N9LLWaoU/qyn0xorDgjTONwJK1W8wvN0hhY1 I4EikchY6/s5lb1UOF+F/BNIuNDX5eDmeypTUDhHwSSHbCdZVACXeiVSIqagXlYrIA9e qtyijzSYFm/l1vBEhGDgA/VfcXVpl4l8c4QvIwlRLP3R8ZL/SLuJpoVlLJ8pd+LrgDQG TGNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dmarc-filter :delivered-to; bh=RSRHZ03BQ36Dt52wUxwJi3sQlRkWpPDw6hAvKXoCZyc=; b=mRT1nhTYnirRAvAIigoKtR6x4a7XFqyzQeZcuAnwoPPa3aRwu8M3ntVPeUgkiNseMU juCZdKht8JdGuAXxdvikH4yT5pH6kIZseSbRK+uwvMNuwU+kd1346WIojb1x2GK7K2Tw OnfchLc5GoHyWaQDD/m/VBDDS4c0BihFAPrFm8NGxP6ZjHn6m3NfHFQI56PejyUNqop/ UnC339lwpyojJtI70bnQU+IoUvF4Se/ezkp1eymZ9LR4rxcWa6ZePlyONCgDjCvQTJKz Gc8KFL76dBCQRQa1TY/V4I5MwMQez6mPx/X0oot6ofBU/aACHg+++tvTOZQlYU+c/3TB y3Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=BJHLZjXX; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id 12-20020a17090600cc00b008dcebb5a0fasi3529588eji.944.2023.02.21.04.51.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:51:28 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=BJHLZjXX; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D2B0E38E814B for ; Tue, 21 Feb 2023 12:17:25 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id DCC4B38323DE for ; Tue, 21 Feb 2023 12:04:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DCC4B38323DE Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x42b.google.com with SMTP id z8so3885795wrm.8 for ; Tue, 21 Feb 2023 04:04:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=RSRHZ03BQ36Dt52wUxwJi3sQlRkWpPDw6hAvKXoCZyc=; b=BJHLZjXX+Eu1KagaPGGQTh3N1kr9GP3jTQwmgViHbnnZfPSdg70OpxYdzAG03EiMQY 8X7so19NEYvIxnlq/ZIHfgGgdCml7LraAYhrHmEnZ+qZXD7AVBvUm0yfxCpLeD6wnfFT d4kgXe25R96wI1GXKrf7HIcI3XKmslFNtlaoxKcx6xSlEVEUQj8cV3ejoT9nFf/xHZNa Pdnn8R/lfwrzx6eYvmcY/JI5HNwr/kf9YL6m3RectXh2XDFu2IyugzmOxqcnWv4iBogf 4j6AOy8yGX4Mv8lV9w42EDVCqJwjHGvp0uvKgN5dyHKpGzzm3VoMK2nLHGv4Nyu6WVs/ 9naA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RSRHZ03BQ36Dt52wUxwJi3sQlRkWpPDw6hAvKXoCZyc=; b=KxO+hWfpKn/dpJho9qBw+hn+gCQZlQOr/3wREvMqn7z4HbZXd/3YxoPK3WrzPH6QhR jQLOtug5sOlKQCL3AyLr1+6AMVP77hQwNdF/p09DfFqlrU/ugdE2KRX0eeRvztLyA0Qa DpEfWu8l0nc7NytB/lepbKAUnT5PpIiu8r67LQZcSs50OTd9qYnG+HIFMWN04VF56Gzb g83cr/11j7O9eUIGKks6CMwzulG98vYj0uChkTW3JvvtEhPgYoHrTmJdenGcnv8Am56L 7vj8BXTqOwRNNABOZUAHSWZ2IrxeI4ofUFNyfM7ez8gepd/jNK+ec0by1jAtKEZn7RTs xNVQ== X-Gm-Message-State: AO0yUKV6+iQy2d+ID5/wH21xbCP0LVcplLFjeXDiQAT8tViUlqTWhzry iPE3kiU1PqdVv4GBgRT/y8OlikhW8xg1wSx7Ug== X-Received: by 2002:a5d:4149:0:b0:2c4:695:d644 with SMTP id c9-20020a5d4149000000b002c40695d644mr4043107wrq.9.1676981075301; Tue, 21 Feb 2023 04:04:35 -0800 (PST) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id c15-20020adffb4f000000b002c55b0e6ef1sm5013811wrs.4.2023.02.21.04.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:04:34 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Jakub Dupak Subject: [committed 090/103] gccrs: ast: Dump no comma after self in fn params if it is the last one Date: Tue, 21 Feb 2023 13:02:20 +0100 Message-Id: <20230221120230.596966-91-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230221120230.596966-1-arthur.cohen@embecosm.com> References: <20230221120230.596966-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758445057347181250?= X-GMAIL-MSGID: =?utf-8?q?1758445057347181250?= From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Fix dumping of fn params. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index 9ec847c4f88..131e23ea180 100644 --- a/gcc/rust/ast/rust-ast-dump.cc +++ b/gcc/rust/ast/rust-ast-dump.cc @@ -1077,8 +1077,12 @@ Dump::visit (Method &method) visit (method.get_visibility ()); stream << "fn " << method.get_method_name () << '('; - stream << method.get_self_param ().as_string () << ", "; - visit_items_joined_by_separator (method.get_function_params (), ", "); + stream << method.get_self_param ().as_string (); + if (!method.get_function_params ().empty ()) + { + stream << ", "; + visit_items_joined_by_separator (method.get_function_params (), ", "); + } stream << ") "; @@ -1343,9 +1347,13 @@ Dump::visit (TraitItemMethod &item) // emit_visibility (method.get_visibility ()); stream << "fn " << method.get_identifier () << '('; - stream << method.get_self_param ().as_string () << ", "; + stream << method.get_self_param ().as_string (); - visit_items_joined_by_separator (method.get_function_params (), ", "); + if (!method.get_function_params ().empty ()) + { + stream << ", "; + visit_items_joined_by_separator (method.get_function_params (), ", "); + } stream << ") ";