refactor(compiler): remove expression count helpers

This commit is contained in:
爱特每羊队
2026-08-05 01:33:13 +08:00
parent b8bb208825
commit fd4172203e
6 changed files with 2 additions and 661 deletions
-24
View File
@@ -372,18 +372,10 @@ impl CompileCtx {
self.count_instr_with_ext(3);
}
pub(crate) fn count_ic_set_with_ext(&mut self) {
self.count_ic_instr_with_ext();
}
pub(crate) fn count_call_instr_with_arg_ext(&mut self) {
self.count_instr_with_ext(1);
}
pub(crate) fn count_delete_static(&mut self) {
self.count_instr_with_ext(1);
}
pub(crate) fn count_define_accessor(&mut self) {
self.count_instr_with_ext(1);
}
@@ -394,10 +386,6 @@ impl CompileCtx {
self.count_instr();
}
pub(crate) fn count_jump(&mut self) {
self.count_instr();
}
pub(crate) fn alloc_reg(&mut self) -> u8 {
let r = self.next_reg;
// Registers 254 (this) and 255 (new.target) are reserved by the VM.
@@ -1291,22 +1279,10 @@ impl Compiler {
pub(crate) fn count_expression(&self, expr: &Expression, ctx: &mut CompileCtx) {
match expr {
Expression::BinaryExpression(_)
| Expression::PrivateInExpression(_)
| Expression::UnaryExpression(_)
| Expression::UpdateExpression(_) => self.count_operator(expr, ctx),
Expression::CallExpression(_) | Expression::NewExpression(_) => self.count_call_domain(expr, ctx),
Expression::AssignmentExpression(_) => self.count_assignment(expr, ctx),
Expression::ConditionalExpression(_)
| Expression::SequenceExpression(_)
| Expression::LogicalExpression(_) => self.count_conditional_chain(expr, ctx),
Expression::ChainExpression(_) => self.count_chain_expression(expr, ctx),
Expression::ArrowFunctionExpression(_)
| Expression::FunctionExpression(_)
| Expression::ClassExpression(_) => self.count_function_domain(expr, ctx),
Expression::StaticMemberExpression(_)
| Expression::ComputedMemberExpression(_)
| Expression::PrivateFieldExpression(_) => self.count_member_domain(expr, ctx),
_ => {}
}
}