aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-07-08 23:39:49 +0100
committergingerBill <bill@gingerbill.org>2020-07-08 23:39:49 +0100
commitcb52f6986a4241becbce14867627939bfc05e5dd (patch)
treef502ccc606b5b681c609fda76e8919470a11fc60 /src
parent94ba1826913893d11d3c373ea0136f773c6218ae (diff)
Fix Addressing_OptionalOk selector expression rules for struct field variables
Diffstat (limited to 'src')
-rw-r--r--src/check_expr.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index eda2b7e95..c33fb4a72 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -3665,16 +3665,19 @@ Entity *check_selector(CheckerContext *c, Operand *operand, Ast *node, Type *typ
}
break;
case Entity_Variable:
- // TODO(bill): Is this the rule I need?
- if (operand->mode == Addressing_Context) {
- if (sel.indirect) {
- operand->mode = Addressing_Variable;
- }
+ if (sel.indirect) {
+ operand->mode = Addressing_Variable;
+ } else if (operand->mode == Addressing_Context) {
+ // Do nothing
} else if (operand->mode == Addressing_MapIndex) {
operand->mode = Addressing_Value;
} else if (entity->flags & EntityFlag_SoaPtrField) {
operand->mode = Addressing_SoaVariable;
- } else if (sel.indirect || operand->mode != Addressing_Value || operand->mode == Addressing_SoaVariable) {
+ } else if (operand->mode == Addressing_OptionalOk) {
+ operand->mode = Addressing_Value;
+ } else if (operand->mode == Addressing_SoaVariable) {
+ operand->mode = Addressing_Variable;
+ } else if (operand->mode != Addressing_Value) {
operand->mode = Addressing_Variable;
} else {
operand->mode = Addressing_Value;