aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-01-27 16:08:47 +0000
committergingerBill <bill@gingerbill.org>2022-01-27 16:08:47 +0000
commit24e7356825a473cba0a1e9962470be73d60ad248 (patch)
tree6ac96d9f9f67d2b67dbdd2bbe9319c0a266f2d2a /src/check_stmt.cpp
parent16786aac78e343fb11a5bd6c971ebb17ccd36f5c (diff)
Add `#no_type_assert` and `#type_assert` to disable implicit type assertions with `x.(T)`
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 94b7561c7..f9e55ab37 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -490,6 +490,14 @@ void check_stmt(CheckerContext *ctx, Ast *node, u32 flags) {
out &= ~StateFlag_no_bounds_check;
}
+ if (in & StateFlag_no_type_assert) {
+ out |= StateFlag_no_type_assert;
+ out &= ~StateFlag_type_assert;
+ } else if (in & StateFlag_type_assert) {
+ out |= StateFlag_type_assert;
+ out &= ~StateFlag_no_type_assert;
+ }
+
ctx->state_flags = out;
}