From patchwork Tue Feb 21 12:01:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 59979 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1829845wrn; Tue, 21 Feb 2023 04:19:52 -0800 (PST) X-Google-Smtp-Source: AK7set/B4SBtAAcTWLlGTBkOxFLeV50ia3WCpdJTluyObVJvYkBeq18PIWp2TOu5Ae8eNwH8yHXO X-Received: by 2002:a05:6402:3890:b0:4a3:43c1:843e with SMTP id fd16-20020a056402389000b004a343c1843emr4882117edb.18.1676981992290; Tue, 21 Feb 2023 04:19:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676981992; cv=none; d=google.com; s=arc-20160816; b=KmlnpF8REfHSFIvzyxaqyFQ2tsl8hEi68XAoERKyyLcIVeX1wHOT3ZrCzk6hVDZlmc 3paVR7vG9PAtCURGz0ITC8VAwqy0UplxrEZmIIph+XdQOOn5XvPWZs9eKovoN256ayDi Gv+UiTpw6NVW8dkPLQcU4qyxFAR2aVPoYHaAbizY8Jdoi9WCiB2BPM0XG1sbr0C9Ax3/ sdfH4mHoLwkZ4h9CB1puytrlejFm6Tfjisc8lfPXRuyDSBRsPjD8SoH6+abCi+xwBWhY tMaC/VTL6K4GxOvYqrrmhsysEiA9pKdFLQAbfCP3gMjbOKz5DDGtpx2ciA7MulgDpu3I /ZZA== 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=slQAgBMvj8tODNXriziEsytCKWacvcjyFcx6cI9juKU=; b=pQcZ862U4JvEzoXEFb5zrN2c5RiYpmtseFHXrCLp8rCJB5FzM1S2raAiqvhcEbjT9i jFnEozK4qbv3zTPRMTSCjDeAr84+b+drXgJrCYMvUa7kL/UJwA4Qq6zt3NOOnplQCy35 41UB8N8dejrXVnZP6ZeF8zdFhIlwJqN9o0u65x7B8hAyQG2OCb/6knOjxaIzXMOG2IKP tImQGBp8qvb+FF8sH/RtaB1N3ET66txnkgcdrWeco3yRMKaBTo0ikMI8Qmc10hlcieKt BgzFD+/voo7LLwWjd+q91TYG5Xiz3YQUiX+t2UJ4n+iUkCEqJbN/F6lpb/iVmL/koR1C t02w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=OSbRP1u8; 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 u4-20020aa7d0c4000000b004aef6266c6bsi7024902edo.325.2023.02.21.04.19.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:19:52 -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=OSbRP1u8; 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 2DF97382999E for ; Tue, 21 Feb 2023 12:08:48 +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 5B033383E29A for ; Tue, 21 Feb 2023 12:03:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5B033383E29A 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 l1so3885566wry.10 for ; Tue, 21 Feb 2023 04:03:49 -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=slQAgBMvj8tODNXriziEsytCKWacvcjyFcx6cI9juKU=; b=OSbRP1u8kYyQ1D8U6apKacJH7miaxFyQycag6ERnyy47ye8qSXUB2EDzoDpjOo42BF wFqCSELXmTu8LwlDthM1VyNAvTf2Rg8AXh6kVOoOFYSAg9vF9fv+Z5JFolLNozfJdakG gayRjGv9GB6anMewlxMbEsjlWPD+y+J+R1gCVkeV4SFPpMS9XvzNfKwQi5wExSn6b6Y8 K6yGZ/2RQqBZgKhKNfItjAd9ewiO8uCCxFWcE6Q5ANoddr1ahuUEpR2nzrNSYg7IXV5y KR58aP4WWjZWEpg3NiCspPZ0VMSt0STalPmDRqq/2q7xjtWrXyBxHIZEoVVoSi4K0xa2 IF+A== 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=slQAgBMvj8tODNXriziEsytCKWacvcjyFcx6cI9juKU=; b=FuXsvr8qWC1dV5J4+9HO+WGbVbqf4VlBKuAdyVoZgNdzZJ5ocjwV4Q9x9uOsafF/zk EdpJHsAzEhbzNh4ve2ecUuimd8oJrqbdKwtcBuPA/D+tf6M1qOBwmoY1vr7I/hevKwED lIrsitUnx8iupiL4i40iGv5AfFtPhREBQbAPM6siOFBGNX6Cpi7rOL75hWcvxiO6G0yW SdQD+ZqnTNqD6V0/YIOP3BQfGiLcaqraehV9mHS9JKP6ZegMakP84PK193IJZXHJanpl dxBx7zmSMzogQhS1bHSQg6hSLBdWRybyQ/ghH5wph+ceEtih/RokNvQ1nzjLfuVyPdK8 Anfw== X-Gm-Message-State: AO0yUKW6KMxhHDQlyQ0rwPKLx6Ktp6vIq197gWGOFU1qx9dZlmU5rNKP TewznbrqAg0ZSV2Jc0AaxGw6P0Tj9zA45UWgUw== X-Received: by 2002:a05:6000:1f10:b0:2c5:512c:f499 with SMTP id bv16-20020a0560001f1000b002c5512cf499mr3279850wrb.27.1676981028702; Tue, 21 Feb 2023 04:03:48 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:03:48 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Jakub Dupak Subject: [committed 032/103] gccrs: ast: dump TypeAlias Date: Tue, 21 Feb 2023 13:01:22 +0100 Message-Id: <20230221120230.596966-33-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.4 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 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?1758443069585571795?= X-GMAIL-MSGID: =?utf-8?q?1758443069585571795?= From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add code for dumping type aliases. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index 8caad987538..fdcd97561bb 100644 --- a/gcc/rust/ast/rust-ast-dump.cc +++ b/gcc/rust/ast/rust-ast-dump.cc @@ -836,7 +836,6 @@ Dump::visit (Function &function) { emit_visibility (function.get_visibility ()); stream << "fn " << function.get_function_name (); - if (function.has_generics ()) emit_generic_params (function.get_generic_params ()); @@ -872,7 +871,24 @@ Dump::visit (Function &function) void Dump::visit (TypeAlias &type_alias) -{} +{ + // Syntax: + // Visibility? type IDENTIFIER GenericParams? WhereClause? = Type; + + // Note: Associated types are handled by `AST::TraitItemType`. + + if (type_alias.has_visibility ()) + emit_visibility (type_alias.get_visibility ()); + stream << "type " << type_alias.get_new_type_name (); + if (type_alias.has_generics ()) + emit_generic_params (type_alias.get_generic_params ()); + if (type_alias.has_where_clause ()) + { + } // FIXME: WhereClause + stream << " = "; + type_alias.get_type_aliased ()->accept_vis (*this); + stream << ";\n"; +} void Dump::visit (StructStruct &struct_item)