diff options
| author | Harold Brenes <harold@hbrenes.com> | 2025-04-23 01:41:38 -0400 |
|---|---|---|
| committer | Harold Brenes <harold@hbrenes.com> | 2025-04-23 02:05:51 -0400 |
| commit | 47abea12290647f371b0488a179d3b254c7489a5 (patch) | |
| tree | f6b70b5f780730ecd7739611526d66e97e48eddb /src/types.cpp | |
| parent | 730c844fc66a9afa6cb8f5ac599cf18c475c7fec (diff) | |
Add support for Objective-C method implementation with Odin calling convention.
Use @objc_context_provider to provide a context for a type.
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp index 96c17f49a..e1386c1f5 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -874,6 +874,29 @@ gb_internal Type *base_type(Type *t) { return t; } +gb_internal Type *base_named_type(Type *t) { + if (t->kind != Type_Named) { + return t_invalid; + } + + Type *prev_named = t; + t = t->Named.base; + for (;;) { + if (t == nullptr) { + break; + } + if (t->kind != Type_Named) { + break; + } + if (t == t->Named.base) { + return t_invalid; + } + prev_named = t; + t = t->Named.base; + } + return prev_named; +} + gb_internal Type *base_enum_type(Type *t) { Type *bt = base_type(t); if (bt != nullptr && |