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 1DC60383E291 for ; Tue, 21 Feb 2023 12:03:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1DC60383E291 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 t13so4088940wrv.13 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=Q5ytcw/yj2KI+tDkh50atQjFBLbdvX3YXiBRyZmkGMmLZszIZVSEtLJg+YLPRN1S6t 5S9sZmFELJRqtOyMWUxgrAGNeFyce3gAXFvWsUEGQaw8eCsW5BgAsn2tlerM1QRDQVDS MnQEIYTnoe64wnIJxh6dbAsTQJ4cRzZBIkSYn1EKGIVQ3yQdQnZozA+e2LvP1/yTdQGX ZnfmvVUYLapJzH9jHtgS2dIbCH4FPQeEKFEp8yvbsk9/94Ypzw4Mgx5bICYdHsJbMDft xf57841/WQ8903eHGvOmnf3d9g4FoTtmwrEQKfXyLuZ3t7wGE7KoQyh4cb8tRvM+6SJj kDNw== X-Gm-Message-State: AO0yUKX3bUnCBGduV5vl/fqQn+lart2YXyDoyzVBiqqdMl/PbkmpKv/u LlzRbYa5GXU9o6o80ZECkZG3TL3kIxSx+A1zug== 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> Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-15.0 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): 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) -- 2.39.1