Skip to content

Commit

Permalink
🎨 disable const generics in funcs for now
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecdjay committed Oct 2, 2023
1 parent af83569 commit a5c6bef
Show file tree
Hide file tree
Showing 2 changed files with 783 additions and 767 deletions.
13 changes: 11 additions & 2 deletions src/gwion.y
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,16 @@ ast

section
: stmt_list { $$ = MK_SECTION(stmt, stmt_list, $1); }
| func_def { $$ = MK_SECTION(func, func_def, $1); }
| func_def {
// temporarly disallow const generics in templates func
if($1->base->tmpl) {
if($1->base->tmpl->list->len != tmplarg_ntypes($1->base->tmpl->list)) {
parser_error(&@1, arg, "const generics not allowed in templates (for now)", 0);
YYERROR;
}
}
$$ = MK_SECTION(func, func_def, $1);
}
| class_def { $$ = MK_SECTION(class, class_def, $1); }
| trait_def { $$ = MK_SECTION(trait, trait_def, $1); }
| extend_def { $$ = MK_SECTION(extend, extend_def, $1); }
Expand Down Expand Up @@ -1141,11 +1150,11 @@ basic_exp
| FLOATT { $$ = new_prim_float( mpool(arg), $1, @$); }
| STRING_LIT { $$ = new_prim_string( mpool(arg), $1, 0, @$); }
| CHAR_LIT { $$ = new_prim_char( mpool(arg), $1, @$); }
| interp { $$ = !$1->next ? $1 : new_prim_interp(mpool(arg), $1, @$); }

prim_exp
: ID { $$ = new_prim_id( mpool(arg), $1, @$); }
| basic_exp
| interp { $$ = !$1->next ? $1 : new_prim_interp(mpool(arg), $1, @$); }
| "[" opt_exp array_lit_end {
if(!$2) {
parser_error(&@1, arg, "must provide values/expressions for array [...]", 0);
Expand Down
Loading

0 comments on commit a5c6bef

Please sign in to comment.