in keyword for for and match type

This commit is contained in:
Ginger Bill
2017-01-27 16:34:58 +00:00
parent d3d3bfd455
commit 832009f33a
10 changed files with 98 additions and 94 deletions
+5 -3
View File
@@ -4071,19 +4071,21 @@ ExprKind check__expr_base(Checker *c, Operand *o, AstNode *node, Type *type_hint
error_node(ie->cond, "Non-boolean condition in if expression");
}
Operand x = {Addressing_Invalid};
Operand y = {Addressing_Invalid};
Type *if_type = NULL;
Type *else_type = NULL;
check_expr(c, &x, ie->body);
if (type_hint) {
gb_printf_err("here\n");
}
check_expr_with_type_hint(c, &x, ie->body, type_hint);
if_type = x.type;
if (ie->else_expr != NULL) {
switch (ie->else_expr->kind) {
case AstNode_IfExpr:
case AstNode_BlockExpr:
check_expr(c, &y, ie->else_expr);
check_expr_with_type_hint(c, &y, ie->else_expr, if_type);
else_type = y.type;
break;
default: