From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AK7set9ni4auhqCJS1LRglVugWdSxHCjRT7LE2/RiSq50mTHCTABaeuCkR8bhK14RA4+yn1PJruoBw== 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> Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 List-Id: 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 << ") "; -- 2.39.1