Skip to content

Commit 7d75efc

Browse files
committed
chore: cleanup QueryCtx and CtxCursor.
1 parent e690633 commit 7d75efc

File tree

1 file changed

+13
-28
lines changed
  • crates/oxc_semantic/src/control_flow/builder

1 file changed

+13
-28
lines changed

crates/oxc_semantic/src/control_flow/builder/context.rs

+13-28
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ pub trait CtxCursor {
4848
fn r#break(self, bb: BasicBlockId) -> Self;
4949
/// Creates a continue entry in the current context.
5050
fn r#continue(self, bb: BasicBlockId) -> Self;
51-
/// Allow break entries in this context.
52-
fn allow_break(self) -> Self;
53-
/// Allow continue entries in this context.
54-
fn allow_continue(self) -> Self;
5551
}
5652

5753
pub struct QueryCtx<'a, 'c>(&'c mut ControlFlowGraphBuilder<'a>, /* label */ Option<&'a str>);
@@ -86,20 +82,6 @@ impl<'a, 'c> CtxCursor for QueryCtx<'a, 'c> {
8682
});
8783
self
8884
}
89-
90-
fn allow_break(self) -> Self {
91-
self.0.in_continue_context(self.1, |ctx| {
92-
ctx.flags.insert(CtxFlags::BREAK);
93-
});
94-
self
95-
}
96-
97-
fn allow_continue(self) -> Self {
98-
self.0.in_continue_context(self.1, |ctx| {
99-
ctx.flags.insert(CtxFlags::CONTINUE);
100-
});
101-
self
102-
}
10385
}
10486

10587
impl<'a, 'c> QueryCtx<'a, 'c> {
@@ -192,6 +174,19 @@ impl<'a, 'c> QueryCtx<'a, 'c> {
192174

193175
pub struct RefCtxCursor<'a, 'c>(&'c mut Ctx<'a>);
194176

177+
impl<'a, 'c> RefCtxCursor<'a, 'c> {
178+
/// Allow break entries in this context.
179+
pub fn allow_break(self) -> Self {
180+
self.0.flags.insert(CtxFlags::BREAK);
181+
self
182+
}
183+
/// Allow continue entries in this context.
184+
pub fn allow_continue(self) -> Self {
185+
self.0.flags.insert(CtxFlags::CONTINUE);
186+
self
187+
}
188+
}
189+
195190
impl<'a, 'c> CtxCursor for RefCtxCursor<'a, 'c> {
196191
fn mark_break(self, jmp_pos: BasicBlockId) -> Self {
197192
debug_assert!(self.0.break_jmp.is_none());
@@ -214,16 +209,6 @@ impl<'a, 'c> CtxCursor for RefCtxCursor<'a, 'c> {
214209
self.0.r#continue(bb);
215210
self
216211
}
217-
218-
fn allow_break(self) -> Self {
219-
self.0.flags.insert(CtxFlags::BREAK);
220-
self
221-
}
222-
223-
fn allow_continue(self) -> Self {
224-
self.0.flags.insert(CtxFlags::CONTINUE);
225-
self
226-
}
227212
}
228213

229214
impl<'a> ControlFlowGraphBuilder<'a> {

0 commit comments

Comments
 (0)