aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-10-01 20:27:02 +0100
committerGinger Bill <bill@gingerbill.org>2017-10-01 20:27:02 +0100
commitafb5538e832d7772b5149c899e78ccb8edf2dde3 (patch)
treeb19b8ab0a6869d6b9f90443fa9002862d394f2b5 /src/ir.cpp
parent1f24f105cc49cff6bbe1034215ae86cb4450f831 (diff)
Default procedure values for `proc`
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 9a18f9195..2c874584f 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -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);
+ }
+ }
+ }
+ }
+
}