Add Var Unpack
This commit is contained in:
14
ast.cpp
14
ast.cpp
@@ -26,6 +26,7 @@ enum Ast_Kind: U32{
|
||||
AST_LENGTH_OF,
|
||||
AST_ALIGN_OF,
|
||||
|
||||
AST_VAR_UNPACK,
|
||||
AST_BREAK,
|
||||
AST_COMPOUND,
|
||||
AST_TYPE,
|
||||
@@ -102,6 +103,11 @@ struct Ast_Call: Ast_Expr{
|
||||
Array<Ast_Call_Item *> exprs;
|
||||
};
|
||||
|
||||
struct Ast_Var_Unpack: Ast_Expr{
|
||||
Array<Ast_Decl *> vars;
|
||||
Ast_Expr *expr;
|
||||
};
|
||||
|
||||
struct Ast_Unary: Ast_Expr{
|
||||
Token_Kind op;
|
||||
Ast_Expr *expr;
|
||||
@@ -554,6 +560,14 @@ ast_alignof(Token *pos, Ast_Expr *expr){
|
||||
return result;
|
||||
}
|
||||
|
||||
function Ast_Var_Unpack *
|
||||
ast_var_unpack(Token *pos, Array<Ast_Decl *> vars, Ast_Expr *expr){
|
||||
AST_NEW(Var_Unpack, VAR_UNPACK, pos, AST_STMT);
|
||||
result->vars = vars.tight_copy(pctx->perm);
|
||||
result->expr = expr;
|
||||
return result;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Value
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user