From patchwork Tue Feb 21 12:01:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 59986 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1831016wrn; Tue, 21 Feb 2023 04:23:03 -0800 (PST) X-Google-Smtp-Source: AK7set9QGIkO0LNwbckPD4CoSM0llgjUvqmKluqWoCgaL7M9bjBXQApfciXwYZb2xwNHoeyomCv9 X-Received: by 2002:a17:907:388c:b0:8b1:2dda:b60d with SMTP id sq12-20020a170907388c00b008b12ddab60dmr8325377ejc.20.1676982183532; Tue, 21 Feb 2023 04:23:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676982183; cv=none; d=google.com; s=arc-20160816; b=lvATRpDwe5O9mOJNsFQkCgTFKpQoLU5Tnk1PPB/r6QglSHy57mMAHpOiSeqYgKCC8C E4F1yt+Ye1PKgRKMTgDerGsH++4KpMIW6qQpmMentnxKhhOoc2OV0HNJkWg+2coINE7p ymEdiTE4lhiy3/AFBV8b7HprUfxy7/o/pSpB1d3RxM3wYAn5ttwmFHoe1tG3gC7X9BPy FzRUtcmYZOM2drTQVYjNJ1stOQVj01LILm+jPEDk4mXDG9Zk/+e0CAQ744xcRbQr5D4L 2lhv4zop+FEfSLXGx1l2lpJD6fs6WKEnEIfLVG7Wvsk3lcK1RR9uG6cjwRo4CYO6Z8eK nKQg== 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=j8r7kNDCFWXkJ7ptre3ZdzURRpaTRXGDaDNJ2FC4p8Y=; b=0wsAzYv9FNybYWXEsCpGpXRrhNjbrdKqKELVP1TKCpSkdfvwwDXI+Tl1AZySDgwAhC nFnquQAXUJruGa04I7/DU7lZAU3ccE/ELbrMSXquv92bfUe29pT478zykv+gtsNY6VY4 5MObuWgLaVFUZv7gAs4AA6nZQl+iNJ2pAnOEtQ/pA9x1MyP2hdPi5wrac7w9QgjUNF7z BzhPDpDjfHTOtvETG+gE4SskcdUF2hbhSjXztiOAuZk/M6zTNGd3m4Pja1JkpoiyHUeY NtjG7NTLpgzW0UYHnEmHXIBocUZKdb4d0q+6zhN7V3c/cDH84kK7dzFXTmzXw3PFHVuW LRzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b="cv/x646h"; 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 fe8-20020a1709072a4800b008d68d018141si4537801ejc.402.2023.02.21.04.23.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:23:03 -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="cv/x646h"; 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 B24203833D88 for ; Tue, 21 Feb 2023 12:09:35 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id B403E385E004 for ; Tue, 21 Feb 2023 12:03:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B403E385E004 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-x42e.google.com with SMTP id r7so3990539wrz.6 for ; Tue, 21 Feb 2023 04:03:39 -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=j8r7kNDCFWXkJ7ptre3ZdzURRpaTRXGDaDNJ2FC4p8Y=; b=cv/x646h4/PJEPhmKmc2PPHjfOVRp5+kVPH+Pu5cXVhTFbbdtQMt8BRzmWOwLZ6AXS +9LxU4IrAIeAE1AptLvbUuMcZVQ0/EXqr/N04MnEoUvl+I7/ndAlOPev10eIDQUgB6uK 3ipxfx8wRvOMGP7mO/r8hE9YnMGw3JY5mSnmhk22fpbeurw+DMywsw0EByZiao+RiTeL M5GjCIpHgMl/ks/VvHCvHLW+B1F0u7s4bibEldmWmblQiCGG6RsCh6LPfQNLSS8bxdlz pEHVss32SfJMDJxjGoiJ74ePoUL0ZST2bqoAm5s+SLo90PjblhBU3XMVFqsWLIl2Ho0n prVg== 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=j8r7kNDCFWXkJ7ptre3ZdzURRpaTRXGDaDNJ2FC4p8Y=; b=yT4njO6TDHryBp+cCgG7SRPsgf/gS0S4wD8ymw1W+wqA2TNzt+E0QEn9CHVVE+dVzh +XTTWeA/ySzU2PMsjqzvj4uNosyIUHwPcvsIfB5wpqEpdQGEVyga9moomOst1QJxSDjv rCYXaK0WiM2kXj0i3RFKkFVmPl3JbqMdkr9b3aOEOVlhX82mBenAkTBXTXjtYo96K22k o4suYoXza/fGH61GUnlIS6wIZZiL2BQoZvj6LjTtkdkeGSVgs9CzrDdgH734cNCYLlD3 /8RYu8aAOKRMaQcwQA4cv8DG+Ts1JUOaRgQcwIrDd/oCGj4yE5ATGIY+d2jqAtFOrVJi YPdw== X-Gm-Message-State: AO0yUKXURIr+XE69uVGE58IBGuzZUyz66jc8fKQc7gNqTsE1tn43r2/F A8KG82H7EdZMlP+LSZpfKOjHJdNq5J/3sXT32w== X-Received: by 2002:a05:6000:5c1:b0:2c5:8b23:bb26 with SMTP id bh1-20020a05600005c100b002c58b23bb26mr2082784wrb.22.1676981019060; Tue, 21 Feb 2023 04:03:39 -0800 (PST) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id c15-20020adffb4f000000b002c55b0e6ef1sm5013811wrs.4.2023.02.21.04.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:03:38 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen Subject: [committed 019/103] gccrs: ast: Add accept_vis() method to `GenericArg` Date: Tue, 21 Feb 2023 13:01:09 +0100 Message-Id: <20230221120230.596966-20-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.9 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?1758443270465032468?= X-GMAIL-MSGID: =?utf-8?q?1758443270465032468?= From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-path.h: Add `accept_vis` method to `GenericArg` class. --- gcc/rust/ast/rust-path.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h index b12e4c2bafa..9683ad6ad68 100644 --- a/gcc/rust/ast/rust-path.h +++ b/gcc/rust/ast/rust-path.h @@ -207,6 +207,23 @@ public: Kind get_kind () const { return kind; } const Location &get_locus () const { return locus; } + void accept_vis (AST::ASTVisitor &visitor) + { + switch (get_kind ()) + { + case Kind::Const: + get_expression ()->accept_vis (visitor); + break; + case Kind::Type: + get_type ()->accept_vis (visitor); + break; + case Kind::Either: + break; + case Kind::Error: + gcc_unreachable (); + } + } + std::unique_ptr &get_expression () { rust_assert (kind == Kind::Const);