mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-26 11:41:13 +08:00
refactor: CompileCtx 拆分为 LabelCtx/ScopeCtx,字面量域改用注册表入口
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
use super::*;
|
||||
|
||||
impl Compiler {
|
||||
/// Domain entry point: count any literal expression. The central
|
||||
/// `count_expression` match delegates all literal variants here in one arm.
|
||||
/// Numeric/String/Boolean/Null share the default single-`LOAD_CONST` shape;
|
||||
/// RegExp emits three instructions.
|
||||
pub(in crate::counter) fn count_literal(&self, expr: &Expression, ctx: &mut CompileCtx) {
|
||||
match expr {
|
||||
Expression::RegExpLiteral(_) => self.count_regexp_literal(ctx),
|
||||
_ => self.count_default_expression(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::counter) fn count_this_expression(&self, ctx: &mut CompileCtx) {
|
||||
ctx.alloc_reg();
|
||||
ctx.projected_pc += 1; // LOAD_VAR from reg 254
|
||||
|
||||
Reference in New Issue
Block a user