From ebb5de23436436d4206766552e76cd4b802e0c74 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Thu, 11 Feb 2021 13:42:07 +0000 Subject: Add in ContinueExpr support We made an implicit loop begin label that can be referenced in a goto to restart the loop. Fixes #188 --- gcc/rust/backend/rust-compile-context.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gcc/rust/backend/rust-compile-context.h') diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h index 288b917..76255b0 100644 --- a/gcc/rust/backend/rust-compile-context.h +++ b/gcc/rust/backend/rust-compile-context.h @@ -219,6 +219,20 @@ public: return back; } + void push_loop_begin_label (Blabel *label) + { + loop_begin_labels.push_back (label); + } + + Blabel *peek_loop_begin_label () { return loop_begin_labels.back (); } + + Blabel *pop_loop_begin_label () + { + Blabel *pop = loop_begin_labels.back (); + loop_begin_labels.pop_back (); + return pop; + } + private: ::Backend *backend; Resolver::Resolver *resolver; @@ -235,6 +249,7 @@ private: std::vector< ::std::vector > statements; std::vector< ::Bblock *> scope_stack; std::vector< ::Bvariable *> loop_value_stack; + std::vector< ::Blabel *> loop_begin_labels; // To GCC middle-end std::vector< ::Btype *> type_decls; -- cgit v1.1