diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-08-07 12:34:41 +0100 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-08-07 12:34:41 +0100 |
| commit | 34b4b84b644c726869b863278f22f223d65e45af (patch) | |
| tree | 3fee3ba1e9b07ab9d6119f46e3818c7baa0a6009 /src/check_builtin.cpp | |
| parent | af3184adc96cef59fff986ea6400caa6dbdb56ae (diff) | |
Add `intrinsics.type_canonical_name`
Diffstat (limited to 'src/check_builtin.cpp')
| -rw-r--r-- | src/check_builtin.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index 57413f519..18c75c455 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -7134,6 +7134,22 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As break; } + case BuiltinProc_type_canonical_name: + { + Operand op = {}; + Type *type = check_type(c, ce->args[0]); + Type *bt = base_type(type); + if (bt == nullptr || bt == t_invalid) { + error(ce->args[0], "Expected a type for '%.*s'", LIT(builtin_name)); + return false; + } + + operand->mode = Addressing_Constant; + operand->type = t_untyped_string; + operand->value = type_to_canonical_string(permanent_allocator(), type); + break; + } + case BuiltinProc_procedure_of: { Ast *call_expr = unparen_expr(ce->args[0]); |