aboutsummaryrefslogtreecommitdiff
path: root/src/tilde_const.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-08-07 14:40:42 +0100
committergingerBill <bill@gingerbill.org>2023-08-07 14:40:42 +0100
commit0c1b39d881a5f91534bf0f33fb945ab57ef293d8 (patch)
tree5b16e10ddad44dccdb8f827294e9f3c73b68dba1 /src/tilde_const.cpp
parent67ffae7e32301a817d73ba68b5e0d6a626c2b4de (diff)
Mock out map get/set functionality
Diffstat (limited to 'src/tilde_const.cpp')
-rw-r--r--src/tilde_const.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/tilde_const.cpp b/src/tilde_const.cpp
index f9187e3e1..691409fe9 100644
--- a/src/tilde_const.cpp
+++ b/src/tilde_const.cpp
@@ -96,7 +96,11 @@ gb_internal cgValue cg_emit_source_code_location_as_global(cgProcedure *p, Strin
return cg_lvalue_addr(ptr, t_source_code_location);
}
-
+gb_internal cgValue cg_emit_source_code_location_as_global(cgProcedure *p, Ast *node) {
+ String proc_name = p->name;
+ TokenPos pos = ast_token(node).pos;
+ return cg_emit_source_code_location_as_global(p, proc_name, pos);
+}
gb_internal void cg_write_big_int_at_ptr(void *dst, BigInt const *a, Type *original_type) {
GB_ASSERT(build_context.endian_kind == TargetEndian_Little);
@@ -949,7 +953,12 @@ gb_internal cgValue cg_const_value(cgProcedure *p, Type *type, ExactValue const
GB_ASSERT(!TB_IS_VOID_TYPE(dt));
// GB_ASSERT(dt.raw != TB_TYPE_I128.raw);
if (is_type_unsigned(type)) {
- u64 i = exact_value_to_u64(value);
+ u64 i = 0;
+ if (value.kind == ExactValue_Integer && value.value_integer.sign) {
+ i = exact_value_to_i64(value);
+ } else {
+ i = exact_value_to_u64(value);
+ }
return cg_value(tb_inst_uint(p->func, dt, i), type);
} else {
i64 i = exact_value_to_i64(value);