public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Arthur Cohen <cohenarthur@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-7516] gccrs: add helper to check for a const or static context Date: Tue, 16 Jan 2024 17:40:41 +0000 (GMT) [thread overview] Message-ID: <20240116174041.2E61338582B2@sourceware.org> (raw) https://gcc.gnu.org/g:0c6338ddb64b8a3fc24470b3040e09ade2f772d8 commit r14-7516-g0c6338ddb64b8a3fc24470b3040e09ade2f772d8 Author: Philip Herron <herron.philip@googlemail.com> Date: Mon Apr 17 22:04:11 2023 +0100 gccrs: add helper to check for a const or static context gcc/rust/ChangeLog: * typecheck/rust-hir-type-check.h: new helper * typecheck/rust-typecheck-context.cc (TypeCheckContext::have_function_context): implementation Signed-off-by: Philip Herron <herron.philip@googlemail.com> Diff: --- gcc/rust/typecheck/rust-hir-type-check.h | 1 + gcc/rust/typecheck/rust-typecheck-context.cc | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/gcc/rust/typecheck/rust-hir-type-check.h b/gcc/rust/typecheck/rust-hir-type-check.h index 3f43bc89d6f..6fa75ecdc33 100644 --- a/gcc/rust/typecheck/rust-hir-type-check.h +++ b/gcc/rust/typecheck/rust-hir-type-check.h @@ -91,6 +91,7 @@ public: void insert_type_by_node_id (NodeId ref, HirId id); bool lookup_type_by_node_id (NodeId ref, HirId *id); + bool have_function_context () const; TyTy::BaseType *peek_return_type (); TypeCheckContextItem peek_context (); void push_return_type (TypeCheckContextItem item, diff --git a/gcc/rust/typecheck/rust-typecheck-context.cc b/gcc/rust/typecheck/rust-typecheck-context.cc index 7c0dc06372d..5d050218dc7 100644 --- a/gcc/rust/typecheck/rust-typecheck-context.cc +++ b/gcc/rust/typecheck/rust-typecheck-context.cc @@ -136,6 +136,12 @@ TypeCheckContext::lookup_type_by_node_id (NodeId ref, HirId *id) return true; } +bool +TypeCheckContext::have_function_context () const +{ + return !return_type_stack.empty (); +} + TyTy::BaseType * TypeCheckContext::peek_return_type () {
reply other threads:[~2024-01-16 17:40 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=20240116174041.2E61338582B2@sourceware.org \ --to=cohenarthur@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).