simple error propagation fix: don't complain about "unused" values that themselves are due to errors

This commit is contained in:
Vern Paxson 2021-01-04 13:39:22 -08:00
parent c8be7ec795
commit 9cb506ad97

View file

@ -311,7 +311,7 @@ ValPtr PrintStmt::DoExec(std::vector<ValPtr> vals,
ExprStmt::ExprStmt(ExprPtr arg_e) : Stmt(STMT_EXPR), e(std::move(arg_e)) ExprStmt::ExprStmt(ExprPtr arg_e) : Stmt(STMT_EXPR), e(std::move(arg_e))
{ {
if ( e && e->IsPure() ) if ( e && e->IsPure() && e->GetType()->Tag() != TYPE_ERROR )
Warn("expression value ignored"); Warn("expression value ignored");
SetLocationInfo(e->GetLocationInfo()); SetLocationInfo(e->GetLocationInfo());