Default procedure values for proc

This commit is contained in:
Ginger Bill
2017-10-01 20:27:02 +01:00
parent 1f24f105cc
commit afb5538e83
3 changed files with 89 additions and 4 deletions
+16
View File
@@ -7422,6 +7422,22 @@ void ir_build_proc(irValue *value, irProcedure *parent) {
proc->module->stmt_state_flags = prev_stmt_state_flags;
}
if (proc->type->Proc.has_proc_default_values) {
auto *p = &proc->type->Proc;
for_array(i, p->params->Tuple.variables) {
Entity *f = p->params->Tuple.variables[i];
if (f->kind == Entity_Variable && f->Variable.default_value.kind == ExactValue_Procedure) {
AstNode *expr = f->Variable.default_value.value_procedure;
GB_ASSERT(expr != nullptr);
if (expr->kind == AstNode_ProcLit) {
ir_gen_anonymous_proc_lit(proc->module, proc->name, expr, proc);
}
}
}
}
}