Core: Remove AST_Tuple, repurpose VAR_UNPACK (buggy probably)
This commit is contained in:
15
core_ast.cpp
15
core_ast.cpp
@@ -110,11 +110,11 @@ ast_expr_index(Token *pos, Ast_Expr *expr, Ast_Expr *index) {
|
||||
}
|
||||
|
||||
CORE_Static Ast_Lambda *
|
||||
ast_lambda(Token *pos, Array<Ast_Decl *> params, Array<Ast_Expr *> ret, Ast_Scope *scope) {
|
||||
ast_lambda(Token *pos, Array<Ast_Decl *> params, Ast_Expr *ret, Ast_Scope *scope) {
|
||||
AST_NEW(Lambda, LAMBDA_EXPR, pos, AST_EXPR);
|
||||
result->flags = AST_EXPR;
|
||||
result->args = params.tight_copy(pctx->perm);
|
||||
result->ret = ret.tight_copy(pctx->perm);
|
||||
result->ret = ret;
|
||||
result->scope = scope;
|
||||
if (scope) scope->parent_ast = result;
|
||||
|
||||
@@ -171,12 +171,9 @@ ast_continue(Token *pos) {
|
||||
}
|
||||
|
||||
CORE_Static Ast_Return *
|
||||
ast_return(Token *pos, Array<Ast_Expr *> expr) {
|
||||
ast_return(Token *pos, Ast_Expr *expr) {
|
||||
AST_NEW(Return, RETURN, pos, AST_STMT);
|
||||
if (expr.len) {
|
||||
For(expr) assert(is_flag_set(it->flags, AST_EXPR));
|
||||
result->expr = expr.tight_copy(pctx->perm);
|
||||
}
|
||||
result->expr = expr;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -623,14 +620,14 @@ void next(Ast_Iter *iter) {
|
||||
case AST_RETURN: {
|
||||
Ast_Return *node = (Ast_Return *)ast;
|
||||
if (!iter->skip_end_blocks) iter->stack.add(node);
|
||||
For(node->expr) iter->stack.add(it);
|
||||
if (node->expr) iter->stack.add(node->expr);
|
||||
} break;
|
||||
|
||||
case AST_LAMBDA_EXPR: {
|
||||
Ast_Lambda *node = (Ast_Lambda *)ast;
|
||||
if (!iter->skip_end_blocks) iter->stack.add(node);
|
||||
if (node->scope) iter->stack.add(node->scope);
|
||||
For(node->ret) iter->stack.add(it);
|
||||
iter->stack.add(node->ret);
|
||||
For(node->args) iter->stack.add(it);
|
||||
} break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user