Skip to content

Commit

Permalink
🔥 more on const generics and spread
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecdjay committed Feb 1, 2024
1 parent 0fc5575 commit a9c86cd
Show file tree
Hide file tree
Showing 3 changed files with 788 additions and 795 deletions.
8 changes: 8 additions & 0 deletions include/absyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ typedef struct TmplArg {
enum tmplarg_t type;
} TmplArg;

ANN static inline uint32_t tmplarg_has_const(TmplArg_List tl) {
for(uint32_t i = 0; i < tl->len; i++) {
TmplArg *ta = mp_vector_at(tl, TmplArg, i);
if(ta->type == tmplarg_exp) return true;
}
return false;
}

ANN static inline uint32_t tmplarg_ntypes(TmplArg_List tl) {
uint32_t ret = 0;
for(uint32_t i = 0; i < tl->len; i++) {
Expand Down
9 changes: 5 additions & 4 deletions src/gwion.y
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,10 @@ decl_exp: con_exp
func_args: "(" arg_list ")" { $$ = $2; } | "(" ")"{ $$ = (struct ParserArg){}; };
fptr_args: "(" fptr_list ")" { $$ = $2; } | "(" ")" { $$ = NULL; };

decl_template: ":[" specialized_list "]" { $$ = $2; }
| ":[" specialized_list "," "..." "]" {
Specialized spec = { .tag = MK_TAG(insert_symbol("..."), @4) };
decl_template
: ":[" specialized_list "]" { $$ = $2; }
| ":[" specialized_list "..." "]" {
Specialized spec = { .tag = MK_TAG(insert_symbol("..."), @3) };
YYLIST_END(Specialized, $$, $2, spec);
}
| ":[" "..." "]" {
Expand Down Expand Up @@ -742,7 +743,7 @@ func_def_base
Type_Decl *td = new_type_decl(mpool(arg), insert_symbol("float"), @3);
Func_Base *base = new_func_base(mpool(arg), td, $3, $5.args, $2, @3);
base->fbflag |= fbflag_locale | $5.flag;
$$ = new_func_def(mpool(arg), base, $7);
$$ = new_func_def(mpool(arg), base, $7);
}
| LOCALE ID LPAREN locale_list RPAREN code_list {
Type_Decl *td = new_type_decl(mpool(arg), insert_symbol("float"), @2);
Expand Down
Loading

0 comments on commit a9c86cd

Please sign in to comment.