mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-27 12:11:12 +08:00
refactor: CompileCtx 拆分为 LabelCtx/ScopeCtx,字面量域改用注册表入口
This commit is contained in:
@@ -39,7 +39,7 @@ impl Compiler {
|
||||
ctx.projected_pc += 1; // JMP
|
||||
}
|
||||
|
||||
ctx.label_map.insert(catch_label, ctx.projected_pc);
|
||||
ctx.labels.label_map.insert(catch_label, ctx.projected_pc);
|
||||
if let Some(catch) = &stmt.handler {
|
||||
ctx.push_scope();
|
||||
if let Some(_param) = &catch.param {
|
||||
@@ -55,7 +55,7 @@ impl Compiler {
|
||||
|
||||
if let Some(finally) = &stmt.finalizer {
|
||||
let finally_label = Label::FinallyBody(id);
|
||||
ctx.label_map.insert(finally_label, ctx.projected_pc);
|
||||
ctx.labels.label_map.insert(finally_label, ctx.projected_pc);
|
||||
for fs in &finally.body {
|
||||
self.count_statement(fs, ctx);
|
||||
}
|
||||
@@ -63,6 +63,6 @@ impl Compiler {
|
||||
ctx.projected_pc += 1; // TRY_FINALLY_END
|
||||
}
|
||||
|
||||
ctx.label_map.insert(try_end_label, ctx.projected_pc);
|
||||
ctx.labels.label_map.insert(try_end_label, ctx.projected_pc);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user