Polymorphic procedure, with passed in compile time type but without removing the type in params etc.
This commit is contained in:
@@ -660,7 +660,7 @@ parse_expr(S64 min_bp) {
|
||||
} break;
|
||||
|
||||
case TK_OpenParen: {
|
||||
if (token_is(TK_CloseParen) || (token_is(TK_Identifier) && token_is(TK_Colon, 1)) || token_is(TK_ThreeDots))
|
||||
if (token_is(TK_CloseParen) || (token_is(TK_Identifier) && token_is(TK_Colon, 1)) || (token_is(TK_Polymorph) && token_is(TK_Colon, 1)) || token_is(TK_ThreeDots))
|
||||
left = parse_lambda(token);
|
||||
else {
|
||||
left = parse_expr(0);
|
||||
@@ -930,6 +930,20 @@ parse_decl(B32 is_global) {
|
||||
if (is_flag_set(a->flags, AST_POLYMORPH)) {
|
||||
set_flag(result->flags, AST_POLYMORPH);
|
||||
set_flag(result->flags, AST_PARENT_POLYMORPH);
|
||||
|
||||
int polymorph_count = 0;
|
||||
For(a->args) {
|
||||
if (it->flags & AST_POLYMORPH) {
|
||||
polymorph_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
result->polymorph_parameters.init(pctx->perm, polymorph_count);
|
||||
For(a->args) {
|
||||
if (it->flags & AST_POLYMORPH) {
|
||||
result->polymorph_parameters.add(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_flag_set(flags, AST_FOREIGN))
|
||||
set_flag(expr->flags, flags);
|
||||
|
||||
Reference in New Issue
Block a user