Begin structs, add comment on multiline lambdas, add Ast flags

This commit is contained in:
Krzosa Karol
2022-05-29 11:29:26 +02:00
parent 7de941899f
commit 07b793aacc
7 changed files with 116 additions and 26 deletions

View File

@@ -504,7 +504,7 @@ eval_decl(Ast *ast, Sym *sym){
}
Ast_Begin(AST_CONST, Ast_Const){
Operand expr = eval_expr(node->expr, 0, sym);
Operand expr = eval_expr((Ast_Expr *)node->value, 0, sym);
if(!expr.type) parsing_error(node->pos, "Constant value without expression");
if(!expr.is_const) parsing_error(node->pos, "Value of constant variable is not a constant expression");
return expr;
@@ -519,8 +519,8 @@ function Ast_Lambda *
ast_get_lambda(Ast *ast){
if(ast->kind == AST_CONST){
auto ast_const = (Ast_Const *)ast;
if(ast_const->expr){
auto ast_expr = ast_const->expr;
if(ast_const->value){
auto ast_expr = ast_const->value;
if(ast_expr->kind == AST_LAMBDA){
return (Ast_Lambda *)ast_expr;
}