mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-15 17:25:27 +00:00
Vector index works with booleans now.
This commit is contained in:
@@ -610,10 +610,21 @@ void check_is_expressible(Checker *c, Operand *o, Type *type) {
|
||||
}
|
||||
}
|
||||
|
||||
b32 check_is_expr_vector_index(Checker *c, AstNode *expr) {
|
||||
// HACK(bill): Handle this correctly. Maybe with a custom AddressingMode
|
||||
expr = unparen_expr(expr);
|
||||
if (expr->kind == AstNode_IndexExpr) {
|
||||
ast_node(ie, IndexExpr, expr);
|
||||
Type *t = get_base_type(type_of_expr(&c->info, ie->expr));
|
||||
return is_type_vector(t);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void check_unary_expr(Checker *c, Operand *o, Token op, AstNode *node) {
|
||||
if (op.kind == Token_Pointer) { // Pointer address
|
||||
if (o->mode != Addressing_Variable) {
|
||||
if (o->mode != Addressing_Variable ||
|
||||
check_is_expr_vector_index(c, o->expr)) {
|
||||
ast_node(ue, UnaryExpr, node);
|
||||
gbString str = expr_to_string(ue->expr);
|
||||
defer (gb_string_free(str));
|
||||
|
||||
Reference in New Issue
Block a user