descriptions of "for" statements now include their "value variable" if present

This commit is contained in:
Vern Paxson 2023-11-05 12:58:37 -08:00 committed by Arne Welzel
parent 9356330bce
commit 23c08a05de
2 changed files with 241 additions and 231 deletions

View file

@ -1289,6 +1289,11 @@ void ForStmt::StmtDescribe(ODesc* d) const {
if ( loop_vars->length() ) if ( loop_vars->length() )
d->Add("]"); d->Add("]");
if ( value_var ) {
d->AddSP(",");
value_var->Describe(d);
}
if ( d->IsReadable() ) if ( d->IsReadable() )
d->Add(" in "); d->Add(" in ");
@ -1314,6 +1319,11 @@ TraversalCode ForStmt::Traverse(TraversalCallback* cb) const {
HANDLE_TC_STMT_PRE(tc); HANDLE_TC_STMT_PRE(tc);
} }
if ( value_var ) {
tc = value_var->Traverse(cb);
HANDLE_TC_STMT_PRE(tc);
}
tc = LoopExpr()->Traverse(cb); tc = LoopExpr()->Traverse(cb);
HANDLE_TC_STMT_PRE(tc); HANDLE_TC_STMT_PRE(tc);

File diff suppressed because one or more lines are too long