From 3ea2353194c9c7047c565fe13759fb2341f2c3ce Mon Sep 17 00:00:00 2001 From: pjh456 <147148383@qq.com> Date: Tue, 23 Jun 2026 23:00:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=20SequenceExpression?= =?UTF-8?q?=20+=20=E5=B8=A6=E6=A0=87=E7=AD=BE=20break/continue=20+=20Empty?= =?UTF-8?q?Statement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxide_compiler/src/compiler.rs | 71 +++++++++++++++++++ .../oxide_compiler/src/counter/stmt/basic.rs | 23 ++++++ crates/oxide_compiler/src/counter/stmt/mod.rs | 1 + .../src/emitter/expr/literal.rs | 13 ++++ crates/oxide_compiler/src/emitter/mod.rs | 7 +- .../oxide_compiler/src/emitter/stmt/basic.rs | 62 ++++++++++++++-- .../src/emitter/stmt/iteration.rs | 10 +++ crates/oxide_compiler/src/hash/expression.rs | 6 ++ crates/oxide_compiler/src/hash/statement.rs | 16 ++++- .../tests/compile_stmt_tests.rs | 15 ++++ crates/oxide_vm/tests/control_flow_tests.rs | 69 ++++++++++++++++++ 11 files changed, 284 insertions(+), 9 deletions(-) diff --git a/crates/oxide_compiler/src/compiler.rs b/crates/oxide_compiler/src/compiler.rs index ba246941..936e2e17 100644 --- a/crates/oxide_compiler/src/compiler.rs +++ b/crates/oxide_compiler/src/compiler.rs @@ -125,6 +125,17 @@ pub(crate) enum Label { CatchBody(u32), FinallyBody(u32), TryEnd(u32), + LabeledEnd(u32), +} + +/// A labeled-statement scope active during emission. `break label` targets +/// `break_label`; `continue label` targets `continue_label` (only set when the +/// labeled statement directly wraps an iteration statement). +#[derive(Debug, Clone)] +pub(crate) struct LabelScope { + pub(crate) name: String, + pub(crate) break_label: Label, + pub(crate) continue_label: Option