diff options
| author | gingerBill <bill@gingerbill.org> | 2020-05-14 00:13:26 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-05-14 00:13:26 +0100 |
| commit | f661d3404952d33d4cb683899ebd05d4b580b2bc (patch) | |
| tree | 79f957be88db8740ebdf214a8107672f88a67052 /src/check_type.cpp | |
| parent | af1d4d6e72eeb75b32c40f3d4ca7bf6a78e8a043 (diff) | |
Implement Explicit context creation #639
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 976c945fd..8d8bae1a7 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2501,6 +2501,19 @@ bool check_procedure_type(CheckerContext *ctx, Type *type, Ast *proc_type_node, c->curr_proc_sig = type; c->in_proc_sig = true; + + ProcCallingConvention cc = pt->calling_convention; + if (cc == ProcCC_ForeignBlockDefault) { + cc = ProcCC_CDecl; + if (c->foreign_context.default_cc > 0) { + cc = c->foreign_context.default_cc; + } + } + GB_ASSERT(cc > 0); + if (cc == ProcCC_Odin) { + c->scope->flags |= ScopeFlag_ContextDefined; + } + bool variadic = false; isize variadic_index = -1; bool success = true; @@ -2534,14 +2547,7 @@ bool check_procedure_type(CheckerContext *ctx, Type *type, Ast *proc_type_node, } - ProcCallingConvention cc = pt->calling_convention; - if (cc == ProcCC_ForeignBlockDefault) { - cc = ProcCC_CDecl; - if (c->foreign_context.default_cc > 0) { - cc = c->foreign_context.default_cc; - } - } - GB_ASSERT(cc > 0); + bool optional_ok = (pt->tags & ProcTag_optional_ok) != 0; if (optional_ok) { |