aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-03-24 15:48:31 +0000
committergingerBill <bill@gingerbill.org>2020-03-24 15:48:31 +0000
commitda703edbf47858c832a3f358967051c8f3cccb90 (patch)
treed7bf8176b986473f83c7592ed192b9efec260d3b /src/check_expr.cpp
parentd57fbf48f0cdf4d120679205ef111c3bac4e5545 (diff)
Allow map indices to be referenced `&m[key]` and return a valid pointer if it exists otherwise `nil`
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index d73aebbe4..8df9c8b88 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -1648,8 +1648,11 @@ bool check_is_not_addressable(CheckerContext *c, Operand *o) {
return false;
}
return true;
-
}
+ if (o->mode == Addressing_MapIndex) {
+ return false;
+ }
+
if (o->mode != Addressing_Variable) {
return true;
}