diff options
| author | gingerBill <bill@gingerbill.org> | 2022-01-27 16:08:47 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-01-27 16:08:47 +0000 |
| commit | 24e7356825a473cba0a1e9962470be73d60ad248 (patch) | |
| tree | 6ac96d9f9f67d2b67dbdd2bbe9319c0a266f2d2a /src/check_expr.cpp | |
| parent | 16786aac78e343fb11a5bd6c971ebb17ccd36f5c (diff) | |
Add `#no_type_assert` and `#type_assert` to disable implicit type assertions with `x.(T)`
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 276e9d0bb..fb5a90f5a 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -6883,6 +6883,14 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type 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; + } + c->state_flags = out; } |