diff options
| author | gingerBill <bill@gingerbill.org> | 2023-07-24 16:09:01 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-07-24 16:09:01 +0100 |
| commit | 28fca190ee11f5c19d30007f20caa4c7bf89f655 (patch) | |
| tree | 595c387e0d83bec411e346d301c6c6d3e3d65676 /src/tilde_builtin.cpp | |
| parent | 78116e0ea24aef3f663832edfb5f9cd6aa7b6e57 (diff) | |
Fix `transmute(uintptr)ptr` etc
Diffstat (limited to 'src/tilde_builtin.cpp')
| -rw-r--r-- | src/tilde_builtin.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/tilde_builtin.cpp b/src/tilde_builtin.cpp index b40eacc7f..e30ff1cb0 100644 --- a/src/tilde_builtin.cpp +++ b/src/tilde_builtin.cpp @@ -236,7 +236,6 @@ gb_internal cgValue cg_builtin_mem_copy_non_overlapping(cgProcedure *p, cgValue } - gb_internal cgValue cg_build_builtin(cgProcedure *p, BuiltinProcId id, Ast *expr) { ast_node(ce, CallExpr, expr); @@ -419,6 +418,21 @@ gb_internal cgValue cg_build_builtin(cgProcedure *p, BuiltinProcId id, Ast *expr return cg_emit_arith(p, Token_Quo, diff, cg_const_int(p, t_int, type_size_of(elem)), t_int); } + case BuiltinProc_type_info_of: + { + Ast *arg = ce->args[0]; + TypeAndValue tav = type_and_value_of_expr(arg); + if (tav.mode == Addressing_Type) { + Type *t = default_type(type_of_expr(arg)); + return cg_type_info(p, t); + } + GB_ASSERT(is_type_typeid(tav.type)); + + auto args = slice_make<cgValue>(permanent_allocator(), 1); + args[0] = cg_build_expr(p, arg); + return cg_emit_runtime_call(p, "__type_info_of", args); + } + } |