From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 7381D3841839 for ; Tue, 21 Feb 2023 12:04:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7381D3841839 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-x430.google.com with SMTP id bo30so3604504wrb.0 for ; Tue, 21 Feb 2023 04:04:36 -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=KnqOnQqExqwRMIwmzbINrTM4g/UPCZ6c9WuAU88YkvN6yF0GyqMS7N60HCQ0n3rR2I foje3hJ0hVMkNY7I+G1bmQcMehJtMmpf5xZItiXFKfn/jalrWFQU73FuYJ/U85aWrT5c pDgFYF934i2wDpDTc6jdSMIsA52KJ5ffjgYqrYRjvH7meD7+IfOhNcjCpv6AcTswoOyH SyMkeD1ln1cAvBkdi8bgM/PuFoTyCbAtEwXNM8ZcY23ZwyaqWb7x6OpdBgT7CR7utw2y F06ctzLtn7av+7NrifjpFmW0CeA+qmzPXkqnSO0OWEbsamth2Usnb+xngHoCPW1GCNWy YH1w== X-Gm-Message-State: AO0yUKX7JQV1AHCx+xGJJASWuNb7khcsj0FyOUEZJnC+6QtxvzPwx3Ct dpojCW+6qgpjD1Y8hkQjFxnWqdkkRWV88wGm6Q== 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=unavailable 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