Cleanup, There is no decl anymore, Ast_Named
This commit is contained in:
@@ -197,12 +197,12 @@ gen_ast(Ast *ast){
|
||||
Ast_End();
|
||||
}
|
||||
|
||||
Ast_Begin(AST_VAR, Ast_Decl){
|
||||
Ast_Begin(AST_VAR, Ast_Var){
|
||||
Sym *sym = resolved_get(node);
|
||||
gen_simple_decl(sym->type, node->name);
|
||||
if(node->var.expr){
|
||||
if(node->expr){
|
||||
gen(" = ");
|
||||
gen_expr(node->var.expr);
|
||||
gen_expr(node->expr);
|
||||
}
|
||||
gen(";");
|
||||
Ast_End();
|
||||
@@ -241,12 +241,12 @@ gen_ast(Ast *ast){
|
||||
Ast_End();
|
||||
}
|
||||
|
||||
Ast_Begin(AST_CONST, Ast_Decl){
|
||||
Ast_Begin(AST_CONST, Ast_Const){
|
||||
Sym *sym = resolved_get(node);
|
||||
|
||||
if(sym->type->kind == TYPE_Lambda){
|
||||
if(node->var.expr->kind == AST_LAMBDA){
|
||||
Ast_Lambda *lambda = (Ast_Lambda *)node->var.expr;
|
||||
if(node->expr->kind == AST_LAMBDA){
|
||||
Ast_Lambda *lambda = (Ast_Lambda *)node->expr;
|
||||
gen("static ");
|
||||
gen_simple_decl(lambda->ret->resolved_type, node->name);
|
||||
gen("(");
|
||||
@@ -265,7 +265,7 @@ gen_ast(Ast *ast){
|
||||
else{
|
||||
gen_simple_decl(sym->type, node->name);
|
||||
gen(" = ");
|
||||
gen_expr(node->var.expr);
|
||||
gen_expr(node->expr);
|
||||
gen(";");
|
||||
}
|
||||
}
|
||||
@@ -316,6 +316,7 @@ function String
|
||||
compile_file(String filename){
|
||||
Scratch scratch;
|
||||
String filecontent = os_read_file(scratch, filename);
|
||||
assert(filecontent.len);
|
||||
String result = compile_string(filecontent, filename);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user