check if expr is null

This commit is contained in:
spiel0meister
2025-06-02 23:24:46 +02:00
parent ccef390c0c
commit 648fa9e54a

View File

@@ -263,11 +263,13 @@ gb_internal void check_did_you_mean_scope(String const &name, Scope *scope, char
gb_internal Entity *entity_from_expr(Ast *expr) {
expr = unparen_expr(expr);
switch (expr->kind) {
case Ast_Ident:
return expr->Ident.entity;
case Ast_SelectorExpr:
return entity_from_expr(expr->SelectorExpr.selector);
if (expr != nullptr) {
switch (expr->kind) {
case Ast_Ident:
return expr->Ident.entity;
case Ast_SelectorExpr:
return entity_from_expr(expr->SelectorExpr.selector);
}
}
return nullptr;
}