feat(ir,backend,frontend): Support for and revise ir array param generate

This commit is contained in:
2026-06-07 22:26:23 +08:00
parent 55636e07af
commit b7c2924e8b
11 changed files with 508 additions and 67 deletions
+19
View File
@@ -18,6 +18,7 @@ pub struct HirVarDeclStmt {
pub struct HirVarDeclStmtValue {
pub symbol: SymbolId,
pub name_span: Span,
pub value: Option<HirExpr>,
}
pub struct HirFuncDeclStmt {
@@ -46,6 +47,7 @@ pub enum HirStatement {
VarDecl(HirVarDeclStmt),
If(HirIfStmt),
While(HirWhileStmt),
For(HirForStmt),
Break(HirBreakStmt),
Continue(HirContinueStmt),
}
@@ -67,6 +69,18 @@ pub struct HirWhileStmt {
pub body: HirBlockStmt,
}
pub struct HirForStmt {
pub init: Option<HirForInit>,
pub condition: Option<HirExpr>,
pub update: Option<HirExpr>,
pub body: HirBlockStmt,
}
pub enum HirForInit {
Expr(HirExpr),
VarDecl(HirVarDeclStmt),
}
pub struct HirBreakStmt {
pub span: Span,
}
@@ -102,6 +116,11 @@ pub enum HirExprValue {
op: UnaryOp,
operand: Box<HirExpr>,
},
IncDec {
op: crate::ast::types::IncDecOp,
operand: Box<HirExpr>,
is_prefix: bool,
},
FuncCall(FunctionId, Vec<HirExpr>),
Assign {
lvalue: Box<HirExpr>,