Lambdas, statements, typechecking lambdas

This commit is contained in:
Krzosa Karol
2022-05-25 14:44:30 +02:00
parent 9dc2e1588d
commit b945f3affd
8 changed files with 229 additions and 118 deletions

View File

@@ -25,8 +25,11 @@ struct Parse_Ctx:Lexer{
Allocator *heap;
U64 unique_ids;
Map global_syms;
Map type_map;
Map resolved;
Map syms;
S32 scope;
Array<Sym *> local_syms;
Token empty_token;
@@ -40,8 +43,10 @@ struct Parse_Ctx:Lexer{
perm = perm_allocator;
heap = heap_allocator;
global_syms = {heap};
type_map = {heap};
resolved = {heap};
syms = {heap};
type_map = {heap};
local_syms = {heap};
lex_init(perm, heap, this);
keyword_struct= intern("struct"_s);
@@ -277,8 +282,9 @@ ast_expr_index(Token *pos, Ast_Expr *expr, Ast_Expr *index){
function Ast_Lambda *
ast_lambda(Token *pos, Array<Ast_Lambda_Arg *> params, Ast_Typespec *ret, Ast_Block *block){
AST_NEW(Lambda, AST_LAMBDA, pos);
result->args = params.tight_copy(pctx->perm);
result->ret = ret;
result->args = params.tight_copy(pctx->perm);
result->ret = ret;
result->block = block;
if(!ret){
result->ret = ast_typespec_name(0, intern_void);
}