refactor: 完成语法域入口点迁移,收紧内部方法可见性

This commit is contained in:
2026-06-25 21:53:26 +08:00
parent f7bcfd3846
commit 804a516e38
33 changed files with 403 additions and 222 deletions
@@ -1,7 +1,7 @@
use super::*;
impl Compiler {
pub(in crate::counter) fn count_conditional_expression(&self, expr: &Expression, ctx: &mut CompileCtx) {
fn count_conditional_expression(&self, expr: &Expression, ctx: &mut CompileCtx) {
let Expression::ConditionalExpression(cond) = expr else {
return;
};
@@ -21,7 +21,7 @@ impl Compiler {
ctx.labels.label_map.insert(end_label, ctx.projected_pc);
}
pub(in crate::counter) fn count_sequence_expression(&self, expr: &Expression, ctx: &mut CompileCtx) {
fn count_sequence_expression(&self, expr: &Expression, ctx: &mut CompileCtx) {
let Expression::SequenceExpression(seq) = expr else {
return;
};
@@ -30,7 +30,7 @@ impl Compiler {
}
}
pub(in crate::counter) fn count_logical_expression(&self, expr: &Expression, ctx: &mut CompileCtx) {
fn count_logical_expression(&self, expr: &Expression, ctx: &mut CompileCtx) {
let Expression::LogicalExpression(log) = expr else {
return;
};
@@ -61,4 +61,13 @@ impl Compiler {
ctx.labels.label_map.insert(skip_label, ctx.projected_pc);
}
}
pub(in crate::counter) fn count_conditional_chain(&self, expr: &Expression, ctx: &mut CompileCtx) {
match expr {
Expression::ConditionalExpression(_) => self.count_conditional_expression(expr, ctx),
Expression::SequenceExpression(_) => self.count_sequence_expression(expr, ctx),
Expression::LogicalExpression(_) => self.count_logical_expression(expr, ctx),
_ => {}
}
}
}