aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2026-01-22 13:17:54 +0000
committergingerBill <gingerBill@users.noreply.github.com>2026-01-22 13:17:54 +0000
commitb0064f38cfb7f24d760feb010c09472fc7f896ee (patch)
tree2de2953b2f01c7f00ee18030dda67c104e7c3b98 /src/check_expr.cpp
parent4ace851f9a1e968de805e612c6752db3ea111d00 (diff)
Minor rearrange of `check_is_operand_compound_lit_constant` for future optimization prep
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 99f803a08..8fdd5372b 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -8768,6 +8768,14 @@ gb_internal bool check_is_operand_compound_lit_constant(CheckerContext *c, Opera
if (is_operand_nil(*o)) {
return true;
}
+ if (is_type_any(field_type)) {
+ return false;
+ }
+ if (field_type != nullptr && is_type_typeid(field_type) && o->mode == Addressing_Type) {
+ add_type_info_type(c, o->type);
+ return true;
+ }
+
Ast *expr = unparen_expr(o->expr);
if (expr != nullptr) {
Entity *e = strip_entity_wrapping(entity_from_expr(expr));
@@ -8778,13 +8786,12 @@ gb_internal bool check_is_operand_compound_lit_constant(CheckerContext *c, Opera
add_type_and_value(c, expr, Addressing_Constant, type_of_expr(expr), exact_value_procedure(expr));
return true;
}
- }
- if (field_type != nullptr && is_type_typeid(field_type) && o->mode == Addressing_Type) {
- add_type_info_type(c, o->type);
- return true;
- }
- if (is_type_any(field_type)) {
- return false;
+
+ if (e != nullptr && e->kind == Entity_Variable && e->Variable.is_rodata) {
+ // DeclInfo *d = e->decl_info;
+ // TODO(bill): rodata inlining for non-indirect values
+ // e.g. **NOT** []T{...}
+ }
}
return o->mode == Addressing_Constant;
}