refactor: 清除旧代码并展开 crate

This commit is contained in:
爱特每羊队
2026-07-05 18:43:22 +08:00
parent f9c36ad679
commit 13cf9127e3
66 changed files with 1413 additions and 2566 deletions
@@ -0,0 +1,29 @@
use crate::compiler::{CompileCtx, Compiler};
use oxide_parser::Statement;
mod break_continue;
mod expression;
mod labeled;
mod return_stmt;
impl Compiler {
pub(crate) fn emit_basic_domain(&self, stmt: &Statement, ctx: &mut CompileCtx) -> Result<Option<u8>, String> {
match stmt {
Statement::ExpressionStatement(_) => self.emit_basic_expression(stmt, ctx),
Statement::ReturnStatement(_) => self.emit_basic_return(stmt, ctx),
Statement::EmptyStatement(_) => Ok(None),
_ => Ok(None),
}
}
pub(crate) fn count_basic(&self, stmt: &Statement, ctx: &mut CompileCtx) {
match stmt {
Statement::ExpressionStatement(es) => self.count_expression_statement(es, ctx),
Statement::ReturnStatement(ret) => self.count_return_statement(ret, ctx),
Statement::BreakStatement(_) => self.count_break_statement(ctx),
Statement::ContinueStatement(_) => self.count_continue_statement(ctx),
Statement::LabeledStatement(ls) => self.count_labeled_statement(ls, ctx),
_ => {}
}
}
}