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: 1745540 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=OSbRP1u8; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PLdPC4QhXz23yZ for ; Tue, 21 Feb 2023 23:09:02 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 351E13AAA05C for ; Tue, 21 Feb 2023 12:08:35 +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-Google-Smtp-Source: AK7set++r/piZHW/FwfFoUcqqvd93VfYi9BfneC7kP0ITI05ZiqAhWt6xiixbQHYCu/GwI67fYfw5Q== 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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)