diff options
| author | gingerBill <bill@gingerbill.org> | 2019-03-06 19:08:37 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-03-06 19:08:37 +0000 |
| commit | c67ea9784560d3e56febe8acd6270d4cfa6daa50 (patch) | |
| tree | 69ec8565404c19986a01f707232362d6cf20d36c /src/check_expr.cpp | |
| parent | 15d3f4c190abbeaef2cd6920d16aacaf71c35fe1 (diff) | |
Add implicit selector expressions for in/notin
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 4c921f484..532b79969 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -2144,8 +2144,20 @@ void check_binary_expr(CheckerContext *c, Operand *x, Ast *node, bool use_lhs_as case Token_in: case Token_notin: - check_expr(c, x, be->left); + // IMPORTANT NOTE(bill): This uses right-left evaluation in type checking only no in + check_expr(c, y, be->right); + + if (is_type_bit_set(y->type)) { + Type *elem = base_type(y->type)->BitSet.elem; + check_expr_with_type_hint(c, x, be->left, elem); + } else if (is_type_map(y->type)) { + Type *key = base_type(y->type)->Map.key; + check_expr_with_type_hint(c, x, be->left, key); + } else { + check_expr(c, x, be->left); + } + if (x->mode == Addressing_Invalid) { return; } |