public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] single_ast_node: Add TYPE kind Date: Wed, 8 Jun 2022 12:25:11 +0000 (GMT) [thread overview] Message-ID: <20220608122511.06A7E3892D15@sourceware.org> (raw) https://gcc.gnu.org/g:cf94fd8d51fcbf5f857a26dc7ae09e29384abc95 commit cf94fd8d51fcbf5f857a26dc7ae09e29384abc95 Author: Arthur Cohen <arthur.cohen@embecosm.com> Date: Mon Mar 28 10:33:25 2022 +0200 single_ast_node: Add TYPE kind Diff: --- gcc/rust/ast/rust-ast.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index a22c2d1ad1d..5368c427b42 100644 --- a/gcc/rust/ast/rust-ast.h +++ b/gcc/rust/ast/rust-ast.h @@ -1515,6 +1515,7 @@ public: TRAIT, IMPL, TRAIT_IMPL, + TYPE, }; private: @@ -1528,6 +1529,7 @@ private: std::unique_ptr<TraitItem> trait_item; std::unique_ptr<InherentImplItem> impl_item; std::unique_ptr<TraitImplItem> trait_impl_item; + std::unique_ptr<Type> type; public: SingleASTNode (std::unique_ptr<Expr> expr) @@ -1558,6 +1560,10 @@ public: : kind (TRAIT_IMPL), trait_impl_item (std::move (trait_impl_item)) {} + SingleASTNode (std::unique_ptr<Type> type) + : kind (TYPE), type (std::move (type)) + {} + SingleASTNode (SingleASTNode const &other) { kind = other.kind; @@ -1590,6 +1596,10 @@ public: case TRAIT_IMPL: trait_impl_item = other.trait_impl_item->clone_trait_impl_item (); break; + + case TYPE: + type = other.type->clone_type (); + break; } } @@ -1625,6 +1635,10 @@ public: case TRAIT_IMPL: trait_impl_item = other.trait_impl_item->clone_trait_impl_item (); break; + + case TYPE: + type = other.type->clone_type (); + break; } return *this; } @@ -1699,6 +1713,12 @@ public: return std::move (trait_impl_item); } + std::unique_ptr<Type> take_type () + { + rust_assert (!is_error ()); + return std::move (type); + } + void accept_vis (ASTVisitor &vis) { switch (kind) @@ -1730,6 +1750,10 @@ public: case TRAIT_IMPL: trait_impl_item->accept_vis (vis); break; + + case TYPE: + type->accept_vis (vis); + break; } } @@ -1751,6 +1775,8 @@ public: return impl_item == nullptr; case TRAIT_IMPL: return trait_impl_item == nullptr; + case TYPE: + return type == nullptr; } gcc_unreachable (); @@ -1775,6 +1801,8 @@ public: return "Impl Item: " + impl_item->as_string (); case TRAIT_IMPL: return "Trait Impl Item: " + impl_item->as_string (); + case TYPE: + return "Type: " + type->as_string (); } gcc_unreachable ();
reply other threads:[~2022-06-08 12:25 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220608122511.06A7E3892D15@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).