aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-05-22 12:53:29 +0100
committergingerBill <bill@gingerbill.org>2023-05-22 12:53:29 +0100
commit8bf32ac697ea21ff3b37e5b31fe0fc10e700c9a4 (patch)
tree77e96ea43b5faf78d81ca1d8158db59fe3e24add /src/llvm_backend_expr.cpp
parent540f724b1f57d0d5a40b65a59f6ee82e070c6ee5 (diff)
Minor change to handling of propagation of errors with `---` as a value
Diffstat (limited to 'src/llvm_backend_expr.cpp')
-rw-r--r--src/llvm_backend_expr.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/llvm_backend_expr.cpp b/src/llvm_backend_expr.cpp
index 69443c9a3..143e38a8d 100644
--- a/src/llvm_backend_expr.cpp
+++ b/src/llvm_backend_expr.cpp
@@ -1486,12 +1486,12 @@ gb_internal lbValue lb_emit_conv(lbProcedure *p, lbValue value, Type *t) {
GB_ASSERT(src != nullptr);
GB_ASSERT(dst != nullptr);
+ if (is_type_untyped_uninit(src)) {
+ return lb_const_undef(m, t);
+ }
if (is_type_untyped_nil(src)) {
return lb_const_nil(m, t);
}
- if (is_type_untyped_undef(src)) {
- return lb_const_undef(m, t);
- }
if (LLVMIsConstant(value.value)) {
if (is_type_any(dst)) {
@@ -2132,12 +2132,12 @@ gb_internal lbValue lb_emit_conv(lbProcedure *p, lbValue value, Type *t) {
if (is_type_any(dst)) {
+ if (is_type_untyped_uninit(src)) {
+ return lb_const_undef(p->module, t);
+ }
if (is_type_untyped_nil(src)) {
return lb_const_nil(p->module, t);
}
- if (is_type_untyped_undef(src)) {
- return lb_const_undef(p->module, t);
- }
lbAddr result = lb_add_local_generated(p, t, true);
@@ -3136,11 +3136,11 @@ gb_internal lbValue lb_build_expr_internal(lbProcedure *p, Ast *expr) {
return lb_addr_load(p, lb_build_addr(p, expr));
case_end;
- case_ast_node(u, Undef, expr)
+ case_ast_node(u, Uninit, expr)
lbValue res = {};
if (is_type_untyped(type)) {
res.value = nullptr;
- res.type = t_untyped_undef;
+ res.type = t_untyped_uninit;
} else {
res.value = LLVMGetUndef(lb_type(m, type));
res.type = type;