mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-08 22:13:17 +00:00
Allow x :: y when cond else proc(...){...}
This commit is contained in:
@@ -1470,6 +1470,7 @@ gb_internal Entity *implicit_entity_of_node(Ast *clause) {
|
||||
}
|
||||
|
||||
gb_internal Entity *entity_of_node(Ast *expr) {
|
||||
retry:;
|
||||
expr = unparen_expr(expr);
|
||||
switch (expr->kind) {
|
||||
case_ast_node(ident, Ident, expr);
|
||||
@@ -1490,6 +1491,17 @@ gb_internal Entity *entity_of_node(Ast *expr) {
|
||||
case_ast_node(ce, CallExpr, expr);
|
||||
return ce->entity_procedure_of;
|
||||
case_end;
|
||||
|
||||
case_ast_node(we, TernaryWhenExpr, expr);
|
||||
if (we->cond == nullptr) {
|
||||
break;
|
||||
}
|
||||
if (we->cond->tav.value.kind != ExactValue_Bool) {
|
||||
break;
|
||||
}
|
||||
expr = we->cond->tav.value.value_bool ? we->x : we->y;
|
||||
goto retry;
|
||||
case_end;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user