For loop iterate through arrays and slices
This commit is contained in:
8
ast.cpp
8
ast.cpp
@@ -163,6 +163,10 @@ struct Ast_For: Ast{
|
||||
Ast_Expr *cond;
|
||||
Ast_Expr *iter;
|
||||
Ast_Scope *scope;
|
||||
|
||||
Ast_Decl *array_traversal_var;
|
||||
bool is_array_traversal;
|
||||
bool is_also_slice_traversal;
|
||||
};
|
||||
|
||||
struct Ast_Lambda : Ast_Expr {
|
||||
@@ -266,9 +270,9 @@ struct Ast_Decl: Ast{
|
||||
result->pos = ipos; \
|
||||
result->di = ++pctx->unique_ids
|
||||
|
||||
#define MAKE_AST(T,kind,pos,flags) (T *)ast_new(sizeof(T), kind, pos, flags)
|
||||
#define new_ast(T,kind,pos,flags) (T *)_new_ast(sizeof(T), kind, pos, flags)
|
||||
function Ast *
|
||||
ast_new(SizeU size, Ast_Kind kind, Token *pos, Ast_Flag flags = 0){
|
||||
_new_ast(SizeU size, Ast_Kind kind, Token *pos, Ast_Flag flags = 0){
|
||||
Ast *result = (Ast *)exp_alloc(pctx->perm, size, AF_ZeroMemory);
|
||||
result->flags = flags;
|
||||
result->kind = kind;
|
||||
|
||||
Reference in New Issue
Block a user