fix for avoiding inadvertent interpreter errors in CallExpr::IsPure()

This commit is contained in:
Vern Paxson 2024-08-05 09:26:35 +01:00 committed by Arne Welzel
parent 37fcb231fa
commit 11e9135f80

View file

@ -4070,11 +4070,15 @@ bool CallExpr::IsPure() const {
if ( IsError() ) if ( IsError() )
return true; return true;
if ( ! func->IsPure() ) if ( func->Tag() != EXPR_NAME )
// Indirect call, can't resolve up front.
return false; return false;
auto func_val = func->Eval(nullptr); auto func_id = func->AsNameExpr()->Id();
if ( ! func_id->IsGlobal() )
return false;
auto func_val = func_id->GetVal();
if ( ! func_val ) if ( ! func_val )
return false; return false;