style: 全 workspace 格式订正,消除 fmt 漂移

This commit is contained in:
2026-10-09 23:58:34 +00:00
parent dbdc5556c6
commit c7f7588b81
23 changed files with 172 additions and 218 deletions
@@ -87,33 +87,34 @@ impl Emitter {
pub(crate) fn emit_continue_statement(
&self, stmt: &oxide_parser::ContinueStatement, ctx: &mut CompileCtx,
) -> Result<Option<u32>, String> {
let (continue_label, fd_at_open, fod_at_open, fid_at_open, dd_at_open, target_v_reg) =
if let Some(label) = &stmt.label {
let name = label.name.as_str();
let scope = ctx
.find_label(name)
.ok_or_else(|| format!("SyntaxError: Undefined label '{name}'"))?;
(
scope.continue_label.ok_or_else(|| {
format!("SyntaxError: Illegal continue statement: '{name}' does not denote an iteration statement")
})?,
scope.finally_depth_at_open,
scope.for_of_depth_at_open,
scope.for_in_depth_at_open,
scope.dispose_depth_at_open,
scope.completion_reg,
)
} else {
let entry = ctx.current_loop().ok_or("continue outside loop".to_string())?;
(
entry.continue_label,
entry.finally_depth_at_open,
entry.for_of_depth_at_open,
entry.for_in_depth_at_open,
entry.dispose_depth_at_open,
Some(entry.v_reg),
)
};
let (continue_label, fd_at_open, fod_at_open, fid_at_open, dd_at_open, target_v_reg) = if let Some(label) =
&stmt.label
{
let name = label.name.as_str();
let scope = ctx
.find_label(name)
.ok_or_else(|| format!("SyntaxError: Undefined label '{name}'"))?;
(
scope.continue_label.ok_or_else(|| {
format!("SyntaxError: Illegal continue statement: '{name}' does not denote an iteration statement")
})?,
scope.finally_depth_at_open,
scope.for_of_depth_at_open,
scope.for_in_depth_at_open,
scope.dispose_depth_at_open,
scope.completion_reg,
)
} else {
let entry = ctx.current_loop().ok_or("continue outside loop".to_string())?;
(
entry.continue_label,
entry.finally_depth_at_open,
entry.for_of_depth_at_open,
entry.for_in_depth_at_open,
entry.dispose_depth_at_open,
Some(entry.v_reg),
)
};
if let Some(target_v_reg) = target_v_reg {
self.emit_completion_carry(ctx, target_v_reg);
}
@@ -6,8 +6,7 @@ use oxide_bytecode::opcode::OpCode;
use oxide_ir::inst::Inst;
use oxide_ir::operand::Operand;
use oxide_parser::{
BindingPattern, ForStatementInit, ForStatementLeft, Statement, VariableDeclaration,
VariableDeclarationKind,
BindingPattern, ForStatementInit, ForStatementLeft, Statement, VariableDeclaration, VariableDeclarationKind,
};
impl Emitter {
@@ -137,9 +136,7 @@ impl Emitter {
/// using/await using 声明登记释放栈:把资源值(val_reg)压入释放栈。非
/// using/await using 声明不登记。a 槽为释放提示(0 = 同步、1 = 异步)。
pub(crate) fn emit_dispose_register(
&self, val_reg: u32, kind: VariableDeclarationKind, ctx: &mut CompileCtx,
) {
pub(crate) fn emit_dispose_register(&self, val_reg: u32, kind: VariableDeclarationKind, ctx: &mut CompileCtx) {
if !matches!(kind, VariableDeclarationKind::Using | VariableDeclarationKind::AwaitUsing) {
return;
}