diff options
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index a023bccd5..37f56d350 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -393,6 +393,7 @@ AST_NODE_KIND(_TypeBegin, "", i32) \ AstNode *results; \ u64 tags; \ ProcCallingConvention calling_convention; \ + bool generic; \ }) \ AST_NODE_KIND(PointerType, "pointer type", struct { \ Token token; \ @@ -1370,16 +1371,18 @@ AstNode *ast_helper_type(AstFile *f, Token token) { } -AstNode *ast_proc_type(AstFile *f, Token token, AstNode *params, AstNode *results, u64 tags, ProcCallingConvention calling_convention) { +AstNode *ast_proc_type(AstFile *f, Token token, AstNode *params, AstNode *results, u64 tags, ProcCallingConvention calling_convention, bool generic) { AstNode *result = make_ast_node(f, AstNode_ProcType); result->ProcType.token = token; result->ProcType.params = params; result->ProcType.results = results; result->ProcType.tags = tags; result->ProcType.calling_convention = calling_convention; + result->ProcType.generic = generic; return result; } + AstNode *ast_pointer_type(AstFile *f, Token token, AstNode *type) { AstNode *result = make_ast_node(f, AstNode_PointerType); result->PointerType.token = token; @@ -3214,7 +3217,20 @@ AstNode *parse_proc_type(AstFile *f, Token proc_token, String *link_name_) { if (link_name_) *link_name_ = link_name; - return ast_proc_type(f, proc_token, params, results, tags, cc); + bool is_generic = false; + + for_array(i, params->FieldList.list) { + AstNode *param = params->FieldList.list[i]; + ast_node(f, Field, param); + if (f->type != NULL && + f->type->kind == AstNode_HelperType) { + is_generic = true; + break; + } + } + + + return ast_proc_type(f, proc_token, params, results, tags, cc, is_generic); } AstNode *parse_var_type(AstFile *f, bool allow_ellipsis, bool allow_type_token) { |