[qfcc] Allow initializers in param symtabs for spir-v

This gets the incoming parameters initialized, though currently rather
suboptimally (but that's due to the setup of the call). Next, just need
to handle `return` in inline functions.
This commit is contained in:
Bill Currie 2024-12-12 00:39:09 +09:00
parent ae0cfe47cc
commit 21eed88da5

View file

@ -1944,9 +1944,10 @@ spirv_declare_sym (specifier_t spec, const expr_t *init, symtab_t *symtab,
if (sym->name[0]) { if (sym->name[0]) {
symtab_addsymbol (symtab, sym); symtab_addsymbol (symtab, sym);
} }
if (symtab->type == stab_local) { if (symtab->type == stab_param || symtab->type == stab_local) {
if (init) { if (init) {
if (!block && is_constexpr (init)) { if (!block && is_constexpr (init)) {
printf ("!block %s\n", sym->name);
} else if (block) { } else if (block) {
auto r = new_symbol_expr (sym); auto r = new_symbol_expr (sym);
auto e = assign_expr (r, init); auto e = assign_expr (r, init);